4 Commits
Author SHA1 Message Date
dsql c51b89bcf6 chore: bump to 1.2.0
Signed-off-by: disqualifier <dev@disqualifier.me>
2026-10-16 04:10:27 -04:00
dsql eb4c3efb28 fix: default mentions block @everyone; jump modal times out with the paginator
T2-10 (operator-ruled): mentions_allowed defaulted to AllowedMentions.all(),
so page content (often user-supplied) could ping @everyone/@here and the
paginator overrode a bot-wide none(). default to AllowedMentions(everyone=
False): user/role pings and the bot-wide settings still apply.

T2-11: JumpToPageModal used discord.py's default timeout=None, so every
dismissed modal stayed in ViewStore._modals forever, pinning its paginator.
pass the paginator's timeout.

Signed-off-by: disqualifier <dev@disqualifier.me>
2026-10-16 04:10:23 -04:00
dsql 654c18fece chore: bump to 1.1.0 (logging-discipline audit)
Signed-off-by: disqualifier <dev@disqualifier.me>
2026-08-10 23:00:50 -04:00
dsql 5095953257 fix: drop exc_info on the best-effort cleanup warnings
cache_button refresh and on_timeout delete are best-effort cleanup that swallow the
HTTPException and recover; both logged at WARNING with exc_info=True, dumping a full
traceback on a handled-and-recovered path. exc_info belongs on terminal/unhandled paths -
drop it and fold the exception reason in with %s so the diagnostic is kept without the
traceback noise.

Signed-off-by: disqualifier <dev@disqualifier.me>
2026-08-09 02:13:12 -04:00
3 changed files with 19 additions and 13 deletions

No files matched your search

+5 -4
View File
@@ -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@v1.0.0
dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v1.2.0
```
Direct:
```bash
pip install "dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v1.0.0"
pip install "dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v1.2.0"
```
Requires `discord.py` (pulled transitively).
Drop the `@v1.0.0` suffix from the line above to install the latest unpinned.
Drop the `@v1.2.0` suffix from the line above to install the latest unpinned.
## Basic usage
@@ -149,7 +149,8 @@ through.
- `timeout` — seconds before the view stops (default 180)
- `delete_message_after` — delete the message on timeout
- `per_page` — entries per page (default 1)
- `mentions_allowed` — `AllowedMentions` for sends (default `.all()`)
- `mentions_allowed` — `AllowedMentions` for sends (default `AllowedMentions(everyone=False)`:
no @everyone/@here, user/role pings and the bot-wide settings still apply)
- `ephemeral` — send/edit ephemerally
- `page_text` — format string for the jump button label
- `emojis` — override navigation emojis
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "dpy_paginator"
version = "1.0.0"
version = "1.2.0"
description = "Button-navigated paginator for discord.py — config-free, injectable emojis, installable."
requires-python = ">=3.10"
dependencies = [
+13 -8
View File
@@ -85,7 +85,8 @@ class JumpToPageModal(discord.ui.Modal, title="Jump to Page"):
"""modal that lets a user jump to a specific page"""
def __init__(self, paginator: "DPYPaginator"):
super().__init__()
# share the paginator's timeout so a dismissed modal leaves discord.py's ViewStore
super().__init__(timeout=paginator.timeout)
self.paginator = paginator
self.page_number = discord.ui.TextInput(
label="Enter page number",
@@ -142,7 +143,8 @@ class DPYPaginator(Generic[PageT_co], discord.ui.View):
timeout: seconds before the view stops
delete_message_after: delete the message on timeout
per_page: how many entries render per page
mentions_allowed: AllowedMentions for sends (defaults to all)
mentions_allowed: AllowedMentions for sends (default: no @everyone/@here;
user/role pings and the bot-wide settings still apply)
ephemeral: send/edit ephemerally
page_text: format string for the jump button label
emojis: override navigation emojis (keys: previous/next/cache)
@@ -155,7 +157,7 @@ class DPYPaginator(Generic[PageT_co], discord.ui.View):
raise ValueError("per_page must be >= 1")
self.author_id: Optional[int] = author_id
self.delete_message_after: bool = delete_message_after
self.mentions_allowed = mentions_allowed or discord.AllowedMentions.all()
self.mentions_allowed = mentions_allowed or discord.AllowedMentions(everyone=False)
self.ephemeral: bool = ephemeral
self.current_page: int = 0
self.per_page: int = per_page
@@ -385,8 +387,10 @@ class DPYPaginator(Generic[PageT_co], discord.ui.View):
await self.message.edit(**kwargs)
except (discord.NotFound, discord.Forbidden):
pass
except discord.HTTPException:
log.warning("paginator cache_button: failed to refresh message", exc_info=True)
except discord.HTTPException as exc:
# swallowed best-effort cleanup that recovers - no traceback (exc_info belongs
# on terminal/unhandled paths); the reason is folded in for diagnosis.
log.warning("paginator cache_button: failed to refresh message: %s", exc)
@discord.ui.button(style=discord.ButtonStyle.blurple)
async def next_page(self, interaction: Interaction, _: discord.ui.Button[Self]) -> None:
@@ -464,9 +468,10 @@ class DPYPaginator(Generic[PageT_co], discord.ui.View):
await self.message.delete()
except (discord.NotFound, discord.Forbidden):
pass
except discord.HTTPException:
# best-effort cleanup task; log rather than raise into an unretrieved task
log.warning("paginator on_timeout: failed to delete message", exc_info=True)
except discord.HTTPException as exc:
# best-effort cleanup task; log rather than raise into an unretrieved task. no
# traceback (exc_info belongs on terminal/unhandled paths) - fold the reason in.
log.warning("paginator on_timeout: failed to delete message: %s", exc)
# back-compat alias: the class was originally named ButtonPaginator; DPYPaginator is