Add example for Client.purge_from
This commit is contained in:
parent
493bffc685
commit
92175ea152
@ -1004,7 +1004,7 @@ class Client:
|
|||||||
ClientException
|
ClientException
|
||||||
The number of messages to delete is less than 2 or more than 100.
|
The number of messages to delete is less than 2 or more than 100.
|
||||||
Forbidden
|
Forbidden
|
||||||
You do not have proper permissions to delete the messages or
|
You do not have proper permissions to delete the messages or
|
||||||
you're not using a bot account.
|
you're not using a bot account.
|
||||||
HTTPException
|
HTTPException
|
||||||
Deleting the messages failed.
|
Deleting the messages failed.
|
||||||
@ -1062,6 +1062,17 @@ class Client:
|
|||||||
HTTPException
|
HTTPException
|
||||||
Purging the messages failed.
|
Purging the messages failed.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
---------
|
||||||
|
|
||||||
|
Deleting bot's messages ::
|
||||||
|
|
||||||
|
def is_me(m):
|
||||||
|
return m.author == client.user
|
||||||
|
|
||||||
|
deleted = await client.purge_from(channel, limit=100, check=is_me)
|
||||||
|
await client.send_message(channel, 'Deleted {} message(s)'.format(len(deleted)))
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
--------
|
--------
|
||||||
list
|
list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user