1
0
Fork 0
mirror of synced 2024-05-20 20:42:27 +12:00

Silently catch unable to send message errors

This commit is contained in:
Phxntxm 2017-03-19 17:43:28 -05:00
parent ae46593ec9
commit e158d18c4f
2 changed files with 16 additions and 4 deletions

View file

@ -66,7 +66,10 @@ class Picarto:
else:
channel_id = int(s_id)
channel = server.get_channel(channel_id)
await channel.send("{} has just gone live! View their stream at <{}>".format(member.display_name, data['picarto_url']))
try:
await channel.send("{} has just gone live! View their stream at <{}>".format(member.display_name, data['picarto_url']))
except discord.Forbidden:
pass
self.bot.loop.create_task(utils.update_content('picarto', {'live': 1}, str(m_id)))
elif not online and data['live'] == 1:
for s_id in data['servers']:
@ -82,7 +85,10 @@ class Picarto:
else:
channel_id = int(s_id)
channel = server.get_channel(channel_id)
await channel.send("{} has just gone offline! View their stream next time at <{}>".format(member.display_name, data['picarto_url']))
try:
await channel.send("{} has just gone offline! View their stream next time at <{}>".format(member.display_name, data['picarto_url']))
except discord.Forbidden:
pass
self.bot.loop.create_task(utils.update_content('picarto', {'live': 0}, str(m_id)))
await asyncio.sleep(30)
except Exception as e:

View file

@ -65,7 +65,10 @@ class Twitch:
else:
channel_id = int(s_id)
channel = server.get_channel(channel_id)
await channel.send("{} has just gone live! View their stream at <{}>".format(member.display_name, data['twitch_url']))
try:
await channel.send("{} has just gone live! View their stream at <{}>".format(member.display_name, data['twitch_url']))
except discord.Forbidden:
pass
self.bot.loop.create_task(utils.update_content('twitch', {'live': 1}, str(m_id)))
elif not online and data['live'] == 1:
for s_id in data['servers']:
@ -81,7 +84,10 @@ class Twitch:
else:
channel_id = int(s_id)
channel = server.get_channel(channel_id)
await channel.send("{} has just gone offline! View their stream next time at <{}>".format(member.display_name, data['twitch_url']))
try:
await channel.send("{} has just gone offline! View their stream next time at <{}>".format(member.display_name, data['twitch_url']))
except discord.Forbidden:
pass
self.bot.loop.create_task(utils.update_content('twitch', {'live': 0}, str(m_id)))
await asyncio.sleep(30)
except Exception as e: