1
0
Fork 0
mirror of synced 2024-06-22 16:20:23 +12:00

Corrected an issue where a TypeError Exception wasn't being caught

This commit is contained in:
Phxntxm 2016-12-21 10:36:51 -06:00
parent 2975d4268b
commit 1391bc051a
2 changed files with 6 additions and 5 deletions

View file

@ -72,7 +72,7 @@ class Picarto:
server_alerts = await config.get_content('server_alerts', {'server_id': server_id})
try:
channel_id = server_alerts[0]['channel_id']
except IndexError:
except (IndexError, TypeError):
channel_id = server_id
channel = self.bot.get_channel(channel_id)
# Get the member that has just gone live
@ -107,7 +107,7 @@ class Picarto:
await asyncio.sleep(30)
except Exception as e:
tb = traceback.format_exc()
fmt = "{}\n{0.__class__.__name__}: {0}".format(tb, e)
fmt = "{1}\n{0.__class__.__name__}: {0}".format(tb, e)
log.error(fmt)
@commands.group(pass_context=True, invoke_without_command=True, no_pm=True)

View file

@ -65,9 +65,10 @@ class Twitch:
if server is None:
continue
server_alerts = await config.get_content('server_alerts', {'server_id': server_id})
channel_id = server_id
if len(server_alerts) > 0:
channel_id = server_alerts[0].get('channel_id')
try:
channel_id = server_alerts[0]['channel_id']
except (IndexError, TypeError):
channel_id = server_id
channel = self.bot.get_channel(channel_id)
# Get the member that has just gone live
member = discord.utils.get(server.members, id=m_id)