fix: reject empty pages at construction (v0.1.1)
empty pages gave max_pages=0; get_page(0)/start() then IndexError'd on self.pages[0]. guard in __init__ with a clear ValueError instead of a deferred crash at render. verified: ButtonPaginator([]) -> ValueError; non-empty and single-page intact. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
parent
958920a6ba
commit
4d52ef7f50
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "dpy_paginator"
|
name = "dpy_paginator"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "Button-navigated paginator for discord.py — config-free, injectable emojis, installable."
|
description = "Button-navigated paginator for discord.py — config-free, injectable emojis, installable."
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@ -159,6 +159,8 @@ class ButtonPaginator(Generic[PageT_co], discord.ui.View):
|
|||||||
cache_sleep: seconds to wait after priming before refreshing the view
|
cache_sleep: seconds to wait after priming before refreshing the view
|
||||||
"""
|
"""
|
||||||
super().__init__(timeout=timeout)
|
super().__init__(timeout=timeout)
|
||||||
|
if not pages:
|
||||||
|
raise ValueError("ButtonPaginator requires at least one page")
|
||||||
self.author_id: Optional[int] = author_id
|
self.author_id: Optional[int] = author_id
|
||||||
self.delete_message_after: bool = delete_message_after
|
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.all()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user