mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-17 03:09:05 +00:00
[commands] Add commands.Paginator.__len__
This commit is contained in:
parent
70c5f1723f
commit
25acad5de3
@ -64,6 +64,12 @@ __all__ = [
|
|||||||
class Paginator:
|
class Paginator:
|
||||||
"""A class that aids in paginating code blocks for Discord messages.
|
"""A class that aids in paginating code blocks for Discord messages.
|
||||||
|
|
||||||
|
.. container:: operations
|
||||||
|
|
||||||
|
.. describe:: len(x)
|
||||||
|
|
||||||
|
Returns the total number of characters in the paginator.
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
prefix: Optional[:class:`str`]
|
prefix: Optional[:class:`str`]
|
||||||
@ -138,6 +144,10 @@ class Paginator:
|
|||||||
self._current_page = []
|
self._current_page = []
|
||||||
self._count = 0
|
self._count = 0
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
total = sum(len(p) for p in self._pages)
|
||||||
|
return total + self._count
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pages(self):
|
def pages(self):
|
||||||
"""Returns the rendered list of pages."""
|
"""Returns the rendered list of pages."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user