1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Added error handling for bad arguments

This commit is contained in:
Phxntxm 2016-07-11 07:40:03 -05:00
parent cb0154c077
commit 656990686b
2 changed files with 5 additions and 2 deletions

3
bot.py
View file

@ -54,6 +54,9 @@ async def on_command_error(error, ctx):
if isinstance(error, commands.CommandNotFound):
fmt = "That is not a valid command! If you need asistance on what command to use, please enter '!help'"
await bot.send_message(ctx.message.channel, fmt)
elif isinstance(error, commands.BadArgument):
fmt = "Please provide a valid argument to pass to the command: {}:".format(error)
await bot.send_message(ctx.message.channel, fmt)
else:
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
await bot.send_message(ctx.message.channel, fmt.format(type(error).__name__, error))

View file

@ -36,7 +36,7 @@ async def checkChannels(bot):
await bot.send_message(server, "{} has just gone offline! Catch them next time they stream at {}"
.format(member.name, url))
config.closeConnection()
await asyncio.sleep(180)
await asyncio.sleep(60)
class Twitch:
@ -117,7 +117,7 @@ class Twitch:
ctx.message.author.mention))
config.closeConnection()
@commands.group(pass_context=True, no_pm=True, invoke_without_command=True)
@twitch.group(pass_context=True, no_pm=True, invoke_without_command=True)
async def notify(self, ctx):
"""This can be used to turn notifications on or off"""
pass