Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de572af675 | ||
|
|
234f663f04 | ||
|
|
8c3bacb2f2 |
@@ -9,17 +9,19 @@ 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.2
|
||||
dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.3
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.2"
|
||||
pip install "dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.3"
|
||||
```
|
||||
|
||||
Requires `discord.py` (pulled transitively).
|
||||
|
||||
Drop the `@v0.1.3` suffix from the line above to install the latest unpinned.
|
||||
|
||||
## Basic usage
|
||||
|
||||
Plain pages — just navigation:
|
||||
@@ -139,4 +141,4 @@ in an embed). It may be sync or async.
|
||||
|
||||
## Versioning
|
||||
|
||||
Tagged `vX.Y.Z`. Pin the tag in `requirements.txt`.
|
||||
Releases are tagged `vX.Y.Z`. The install line above pins a release; drop the `@vX.Y.Z` suffix to install the latest unpinned. Pin deliberately for reproducible installs.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "dpy_paginator"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
description = "Button-navigated paginator for discord.py — config-free, injectable emojis, installable."
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
|
||||
@@ -200,7 +200,7 @@ class ButtonPaginator(Generic[PageT_co], discord.ui.View):
|
||||
|
||||
async def interaction_check(self, interaction: Interaction) -> bool:
|
||||
"""restrict interaction to author_id when set"""
|
||||
if not self.author_id or self.author_id == interaction.user.id:
|
||||
if self.author_id is None or self.author_id == interaction.user.id:
|
||||
return True
|
||||
await interaction.response.send_message("You cannot interact with this menu.", ephemeral=True)
|
||||
return False
|
||||
@@ -259,6 +259,14 @@ class ButtonPaginator(Generic[PageT_co], discord.ui.View):
|
||||
if isinstance(value, discord.Attachment):
|
||||
value = await value.to_file()
|
||||
self._page_kwargs["files"].append(value)
|
||||
elif key in ("embed", "embeds", "file", "files"):
|
||||
# a wrong-typed embed/file would otherwise fall to the catch-all and
|
||||
# be forwarded verbatim, colliding with the base embeds=[]/files=[]
|
||||
# and raising an opaque TypeError from inside discord.py — reject it
|
||||
# here with a clear, paginator-side message
|
||||
raise ValueError(
|
||||
f"page key {key!r} has unexpected type {type(value).__name__}"
|
||||
)
|
||||
else:
|
||||
self._page_kwargs[key] = value
|
||||
elif isinstance(formatted_page, str):
|
||||
|
||||
Reference in New Issue
Block a user