refactor: rename ButtonPaginator -> DPYPaginator (keep ButtonPaginator as alias)
the paginator class is now DPYPaginator, matching the package name (dpy_paginator), for naming consistency with the suite. ButtonPaginator is kept as a back-compat alias (ButtonPaginator = DPYPaginator), so existing imports and call sites keep working unchanged. both names are exported in __all__. mirrors the suite's alias convention (aioweb Response/aiowebResponse, envelope_crypto EnvelopeCrypto/PCICrypto). verified against discord.py 2.7.1: both names resolve to the same class, construction via either name works, the empty-pages ValueError message updated. v0.1.6. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -9,28 +9,31 @@ 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.5
|
||||
dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.6
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.5"
|
||||
pip install "dpy_paginator @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_paginator.git@v0.1.6"
|
||||
```
|
||||
|
||||
Requires `discord.py` (pulled transitively).
|
||||
|
||||
Drop the `@v0.1.5` suffix from the line above to install the latest unpinned.
|
||||
Drop the `@v0.1.6` suffix from the line above to install the latest unpinned.
|
||||
|
||||
## Basic usage
|
||||
|
||||
The paginator class is `DPYPaginator`. It is also exported as `ButtonPaginator` (a
|
||||
back-compat alias) — both names refer to the same class, so either import works.
|
||||
|
||||
Plain pages — just navigation:
|
||||
|
||||
```python
|
||||
from dpy_paginator import ButtonPaginator
|
||||
from dpy_paginator import DPYPaginator # or: from dpy_paginator import ButtonPaginator
|
||||
|
||||
pages = [discord.Embed(title=f"Page {i}") for i in range(5)]
|
||||
await ButtonPaginator(pages, author_id=ctx.author.id).start(ctx)
|
||||
await DPYPaginator(pages, author_id=ctx.author.id).start(ctx)
|
||||
```
|
||||
|
||||
`start()` accepts an `Interaction` or any `Messageable` (a `Context`, channel, etc.).
|
||||
@@ -41,7 +44,7 @@ Navigation uses plain Unicode by default — no setup, no emoji upload required.
|
||||
`emojis=` to override with custom application/guild emojis the bot can use:
|
||||
|
||||
```python
|
||||
ButtonPaginator(pages, emojis={
|
||||
DPYPaginator(pages, emojis={
|
||||
"previous": "<:icon_back:123...>",
|
||||
"next": "<:icon_next:123...>",
|
||||
"cache": "<:icon_cache:123...>",
|
||||
@@ -91,7 +94,7 @@ for session in sessions:
|
||||
],
|
||||
})
|
||||
|
||||
paginator = ButtonPaginator(
|
||||
paginator = DPYPaginator(
|
||||
pages, cache=None, timeout=900, delete_message_after=True,
|
||||
mentions_allowed=discord.AllowedMentions.none(), ephemeral=True,
|
||||
page_text="Session {} of {}",
|
||||
@@ -124,7 +127,7 @@ for group in groups:
|
||||
pages.append(build_embed(group))
|
||||
cache.append(" ".join(f"<@{uid}>" for uid in group["user_ids"]))
|
||||
|
||||
await ButtonPaginator(pages, cache=cache, cache_sleep=1.0).start(ctx)
|
||||
await DPYPaginator(pages, cache=cache, cache_sleep=1.0).start(ctx)
|
||||
```
|
||||
|
||||
Omit `cache` or pass `None`/`[]` and the button never appears. When set, `cache`
|
||||
|
||||
Reference in New Issue
Block a user