diff --git a/app/dragon-bot.py b/app/dragon-bot.py index 7c107bb4..89a92c5f 100644 --- a/app/dragon-bot.py +++ b/app/dragon-bot.py @@ -164,12 +164,13 @@ async def on_message(message): if message.content.startswith('!purge'): num = 20 if len(message.content.split()) > 1: - num = message.content.split()[1] try: - await client.purge_from(message.channel, limit=num, check=is_me) + num = int(message.content.split()[1]) except ValueError: - await client.send_message(message.channel, 'You want me to purge what?') - + # 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'):