Fixed global command error handling
This commit is contained in:
parent
28b47d2a13
commit
e9bacca70d
11
bot.py
11
bot.py
|
@ -31,21 +31,26 @@ async def on_ready():
|
|||
cursor.execute('update restart_server set channel_id=0 where id=1')
|
||||
config.closeConnection()
|
||||
|
||||
@bot.event
|
||||
async def on_message(message):
|
||||
if message.author.bot:
|
||||
return
|
||||
await bot.process_commands(message)
|
||||
|
||||
@bot.event
|
||||
async def on_member_join(member):
|
||||
await bot.say("Welcome to the '{0.server.name}' server {0.mention}!".format(member))
|
||||
await bot.send_message(member.server,"Welcome to the '{0.server.name}' server {0.mention}!".format(member))
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_member_remove(member):
|
||||
await bot.say("{0} has left the server, I hope it wasn't because of something I said :c".format(member))
|
||||
await bot.send_message(member.server,"{0} has left the server, I hope it wasn't because of something I said :c".format(member))
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_command_error(error, ctx):
|
||||
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
|
||||
await bot.say(fmt.format(type(error).__name__, error))
|
||||
await bot.send_message(ctx.message.channel,fmt.format(type(error).__name__, error))
|
||||
|
||||
if __name__ == '__main__':
|
||||
for e in extensions:
|
||||
|
|
Loading…
Reference in a new issue