diff options
| author | Rapptz <[email protected]> | 2016-05-12 09:05:51 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-05-12 09:05:51 -0400 |
| commit | 92175ea152a769a4c42e807fe7c3d277b0c7fb11 (patch) | |
| tree | aecfad3700e21367f74fc2cba0f4239829b06d19 | |
| parent | Rework playlist example to work with multi-server voice. (diff) | |
| download | discord.py-92175ea152a769a4c42e807fe7c3d277b0c7fb11.tar.xz discord.py-92175ea152a769a4c42e807fe7c3d277b0c7fb11.zip | |
Add example for Client.purge_from
| -rw-r--r-- | discord/client.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/discord/client.py b/discord/client.py index 54e5ca85..3ceed252 100644 --- a/discord/client.py +++ b/discord/client.py @@ -1004,7 +1004,7 @@ class Client: ClientException The number of messages to delete is less than 2 or more than 100. 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. HTTPException Deleting the messages failed. @@ -1062,6 +1062,17 @@ class Client: HTTPException 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 -------- list |