aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/client.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/discord/client.py b/discord/client.py
index b0c920b3..7ac7ca66 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -1058,10 +1058,12 @@ class Client:
check : predicate
The function used to check if a message should be deleted.
It must take a :class:`Message` as its sole parameter.
- before : :class:`Message`
- The message before scanning for purging must be.
- after : :class:`Message`
- The message after scanning for purging must be.
+ before : :class:`Message` or `datetime`
+ The message or date before which all deleted messages must be.
+ If a date is provided it must be a timezone-naive datetime representing UTC time.
+ after : :class:`Message` or `datetime`
+ The message or date after which all deleted messages must be.
+ If a date is provided it must be a timezone-naive datetime representing UTC time.
Raises
-------
@@ -1091,6 +1093,11 @@ class Client:
if check is None:
check = lambda m: True
+ if isinstance(before, datetime.datetime):
+ before = Object(utils.time_snowflake(before, high=False))
+ if isinstance(after, datetime.datetime):
+ after = Object(utils.time_snowflake(after, high=True))
+
iterator = LogsFromIterator.create(self, channel, limit, before=before, after=after)
ret = []
count = 0