diff options
| author | Rapptz <[email protected]> | 2017-01-11 16:36:15 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-01-11 19:04:52 -0500 |
| commit | 8c274139dfcd21c1430aa423012c8522ddf9dd19 (patch) | |
| tree | 4a5c9d790c8849f2e9b475df92ec3df3a44d8c35 /discord/abc.py | |
| parent | Propagate event loop in Messageable.history. (diff) | |
| download | discord.py-8c274139dfcd21c1430aa423012c8522ddf9dd19.tar.xz discord.py-8c274139dfcd21c1430aa423012c8522ddf9dd19.zip | |
Allow HistoryIterator to be flattened into a list.
Diffstat (limited to 'discord/abc.py')
| -rw-r--r-- | discord/abc.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/discord/abc.py b/discord/abc.py index 3a7d1556..0cae7b49 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -31,7 +31,7 @@ import asyncio from collections import namedtuple -from .iterators import LogsFromIterator +from .iterators import HistoryIterator from .context_managers import Typing from .errors import ClientException, NoMoreMessages, InvalidArgument from .permissions import PermissionOverwrite, Permissions @@ -728,6 +728,11 @@ class Messageable(metaclass=abc.ABCMeta): if message.author == client.user: counter += 1 + Flattening into a list: :: + + messages = await channel.history(limit=123).flatten() + # messages is now a list of Message... + Python 3.4 Usage :: count = 0 @@ -741,7 +746,7 @@ class Messageable(metaclass=abc.ABCMeta): if message.author == client.user: counter += 1 """ - return LogsFromIterator(self, limit=limit, before=before, after=after, around=around, reverse=reverse) + return HistoryIterator(self, limit=limit, before=before, after=after, around=around, reverse=reverse) @asyncio.coroutine def purge(self, *, limit=100, check=None, before=None, after=None, around=None): |