From 9e55b29e116d69c2c6ea0fb035ad78f0e4601202 Mon Sep 17 00:00:00 2001 From: disqualifier Date: Fri, 3 Jul 2026 19:07:24 -0400 Subject: [PATCH] fix: multi-entry pages join dict content instead of dropping all but the last The dict-entry catch-all assigned kwargs["content"] = value directly, so a per_page > 1 page combining multiple dict entries silently kept only the last entry's content while embeds/files/buttons from every entry still accumulated - an asymmetry that dropped text with no error. The dict branch's content key now routes through the same None-check/newline-join accumulation the plain-str branch already used, so every entry's content survives in order. Signed-off-by: disqualifier --- README.md | 11 ++++++++--- pyproject.toml | 2 +- src/dpy_paginator/dpy_paginator.py | 3 +++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ec1d3d2..4fe2d37 100644 --- a/README.md +++ b/README.md @@ -9,18 +9,18 @@ buttons) behind previous / jump / next navigation, with an optional cache button `requirements.txt`: ``` -dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.8 +dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.9 ``` Direct: ```bash -pip install "dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.8" +pip install "dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.9" ``` Requires `discord.py` (pulled transitively). -Drop the `@v0.1.8` suffix from the line above to install the latest unpinned. +Drop the `@v0.1.9` suffix from the line above to install the latest unpinned. ## Basic usage @@ -61,6 +61,11 @@ those, or a `dict`. A dict page can carry `content`, `embed`/`embeds`, `files` accept a `discord.Attachment` and convert it via `to_file()` automatically — you never need to convert an attachment before passing it in. +With `per_page > 1`, multiple entries render onto one page. `content` from each +entry (whether a plain `str` entry or a dict's `content` key) joins with `\n` in +order, same as `embeds`/`files`/`buttons` accumulate — no entry's content is +dropped in favor of another's. + File pages are safe to navigate back to. discord.py closes a `discord.File`'s underlying handle after every send/edit, so the paginator never resends your File object directly — it rebuilds a fresh `discord.File` from the same source (path or diff --git a/pyproject.toml b/pyproject.toml index 84767d7..7eb5602 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "dpy_paginator" -version = "0.1.8" +version = "0.1.9" description = "Button-navigated paginator for discord.py — config-free, injectable emojis, installable." requires-python = ">=3.10" dependencies = [ diff --git a/src/dpy_paginator/dpy_paginator.py b/src/dpy_paginator/dpy_paginator.py index 1976871..3381ba1 100644 --- a/src/dpy_paginator/dpy_paginator.py +++ b/src/dpy_paginator/dpy_paginator.py @@ -279,6 +279,9 @@ class DPYPaginator(Generic[PageT_co], discord.ui.View): raise ValueError( f"page key {key!r} has unexpected type {type(value).__name__}" ) + elif key == "content": + existing = kwargs["content"] + kwargs["content"] = value if existing is None else f"{existing}\n{value}" else: kwargs[key] = value elif isinstance(formatted_page, str):