Merged in purgeargs (pull request #12)

Add arg to !purge, fixes #2

Approved-by: Luke Robles <lukelrobles@gmail.com>
This commit is contained in:
Kyler E Juresic 2017-08-09 20:16:22 +00:00
commit 216e8d232f
2 changed files with 11 additions and 3 deletions

View File

@ -162,7 +162,15 @@ async def on_message(message):
await client.send_message(message.channel, random.choice(excuses))
if message.content.startswith('!purge'):
await client.purge_from(message.channel, limit=20, check=is_me)
num = 20
if len(message.content.split()) > 1:
try:
num = int(message.content.split()[1])
except ValueError:
# If they dont enter a number, show them an error and return out of the function
await client.send_message(message.channel, "You need to give me a number, you entered {}".format(message.content.split()[1]))
return
await client.purge_from(message.channel, limit=num, check=is_me)
# await client.send_message(message.channel, 'Deleted {} message(s)'.format(len(deleted)))
if message.content.startswith('!decide'):

View File

@ -25,8 +25,8 @@ def get_help_message(method):
'Can only be used in NSFW channels'
],
'purge': [
'Deletes the last 100 messages you sent from the channel you',
'typed purge in'
'Deletes the last 20 messages you sent from the channel you',
'typed purge in, unless otherwise specified. eg. !purge 8'
],
'triggered': [
'REEEEEEEEEEEEEEEEEE'],