diff options
| author | Rapptz <[email protected]> | 2019-03-16 03:38:51 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-03-16 03:38:51 -0400 |
| commit | 25acad5de3801feb3e1681ce19c5b21efbf8f414 (patch) | |
| tree | 30a1844e03abf3d0c278b2db6c058160879d1348 /discord/ext/commands/help.py | |
| parent | Fix Embed.to_dict to work with TZ aware datetime objects. (diff) | |
| download | discord.py-25acad5de3801feb3e1681ce19c5b21efbf8f414.tar.xz discord.py-25acad5de3801feb3e1681ce19c5b21efbf8f414.zip | |
[commands] Add commands.Paginator.__len__
Diffstat (limited to 'discord/ext/commands/help.py')
| -rw-r--r-- | discord/ext/commands/help.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py index 3f956e55..4ad34e53 100644 --- a/discord/ext/commands/help.py +++ b/discord/ext/commands/help.py @@ -64,6 +64,12 @@ __all__ = [ class Paginator: """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 ----------- prefix: Optional[:class:`str`] @@ -138,6 +144,10 @@ class Paginator: self._current_page = [] self._count = 0 + def __len__(self): + total = sum(len(p) for p in self._pages) + return total + self._count + @property def pages(self): """Returns the rendered list of pages.""" |