Added error handling for bad arguments
This commit is contained in:
parent
cb0154c077
commit
656990686b
3
bot.py
3
bot.py
|
@ -54,6 +54,9 @@ async def on_command_error(error, ctx):
|
||||||
if isinstance(error, commands.CommandNotFound):
|
if isinstance(error, commands.CommandNotFound):
|
||||||
fmt = "That is not a valid command! If you need asistance on what command to use, please enter '!help'"
|
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)
|
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:
|
else:
|
||||||
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
|
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
|
||||||
await bot.send_message(ctx.message.channel, fmt.format(type(error).__name__, error))
|
await bot.send_message(ctx.message.channel, fmt.format(type(error).__name__, error))
|
||||||
|
|
|
@ -36,7 +36,7 @@ async def checkChannels(bot):
|
||||||
await bot.send_message(server, "{} has just gone offline! Catch them next time they stream at {}"
|
await bot.send_message(server, "{} has just gone offline! Catch them next time they stream at {}"
|
||||||
.format(member.name, url))
|
.format(member.name, url))
|
||||||
config.closeConnection()
|
config.closeConnection()
|
||||||
await asyncio.sleep(180)
|
await asyncio.sleep(60)
|
||||||
|
|
||||||
|
|
||||||
class Twitch:
|
class Twitch:
|
||||||
|
@ -117,7 +117,7 @@ class Twitch:
|
||||||
ctx.message.author.mention))
|
ctx.message.author.mention))
|
||||||
config.closeConnection()
|
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):
|
async def notify(self, ctx):
|
||||||
"""This can be used to turn notifications on or off"""
|
"""This can be used to turn notifications on or off"""
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue