Correctly handle str/int conversions
This commit is contained in:
parent
22c4b57991
commit
582e33d907
|
@ -53,7 +53,6 @@ class Twitch:
|
||||||
# If they're currently online, but saved as not then we'll send our notification
|
# If they're currently online, but saved as not then we'll send our notification
|
||||||
if online and data['live'] == 0:
|
if online and data['live'] == 0:
|
||||||
for s_id in data['servers']:
|
for s_id in data['servers']:
|
||||||
s_id = int(s_id)
|
|
||||||
server = self.bot.get_guild(s_id)
|
server = self.bot.get_guild(s_id)
|
||||||
if server is None:
|
if server is None:
|
||||||
continue
|
continue
|
||||||
|
@ -64,13 +63,12 @@ class Twitch:
|
||||||
if server_settings is not None:
|
if server_settings is not None:
|
||||||
channel_id = int(server_settings.get('notification_channel', s_id))
|
channel_id = int(server_settings.get('notification_channel', s_id))
|
||||||
else:
|
else:
|
||||||
channel_id = s_id
|
channel_id = int(s_id)
|
||||||
channel = server.get_channel(channel_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']))
|
await channel.send("{} has just gone live! View their stream at <{}>".format(member.display_name, data['twitch_url']))
|
||||||
self.bot.loop.create_task(utils.update_content('twitch', {'live': 1}, str(m_id)))
|
self.bot.loop.create_task(utils.update_content('twitch', {'live': 1}, str(m_id)))
|
||||||
elif not online and data['live'] == 1:
|
elif not online and data['live'] == 1:
|
||||||
for s_id in data['servers']:
|
for s_id in data['servers']:
|
||||||
s_id = int(s_id)
|
|
||||||
server = self.bot.get_guild(s_id)
|
server = self.bot.get_guild(s_id)
|
||||||
if server is None:
|
if server is None:
|
||||||
continue
|
continue
|
||||||
|
@ -81,7 +79,7 @@ class Twitch:
|
||||||
if server_settings is not None:
|
if server_settings is not None:
|
||||||
channel_id = int(server_settings.get('notification_channel', s_id))
|
channel_id = int(server_settings.get('notification_channel', s_id))
|
||||||
else:
|
else:
|
||||||
channel_id = s_id
|
channel_id = int(s_id)
|
||||||
channel = server.get_channel(channel_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']))
|
await channel.send("{} has just gone offline! View their stream next time at <{}>".format(member.display_name, data['twitch_url']))
|
||||||
self.bot.loop.create_task(utils.update_content('twitch', {'live': 0}, str(m_id)))
|
self.bot.loop.create_task(utils.update_content('twitch', {'live': 0}, str(m_id)))
|
||||||
|
|
Loading…
Reference in a new issue