Make the bot silently continue if logging fails

This commit is contained in:
Ske 2018-07-16 01:06:29 +02:00
parent 4bdc14e161
commit e22667ce90

View File

@ -33,7 +33,11 @@ async def log_message(original_message, hook_message, member, log_channel):
message_link = "https://discordapp.com/channels/{}/{}/{}".format(original_message.server.id, original_message.channel.id, hook_message.id) message_link = "https://discordapp.com/channels/{}/{}/{}".format(original_message.server.id, original_message.channel.id, hook_message.id)
embed.author.url = message_link embed.author.url = message_link
await client.send_message(log_channel, embed=embed) try:
await client.send_message(log_channel, embed=embed)
except discord.errors.Forbidden:
# Ignore logging permission errors, perhaps make it spam a big nasty error instead
pass
async def log_delete(hook_message, member, log_channel): async def log_delete(hook_message, member, log_channel):
embed = make_log_embed(hook_message, member, channel_name=hook_message.channel.name) embed = make_log_embed(hook_message, member, channel_name=hook_message.channel.name)