From 1473dc9e6776dc9c47888818da25b18910b48534 Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sun, 12 Mar 2017 16:46:43 -0500 Subject: [PATCH] Convert id's to int --- cogs/picarto.py | 6 +++++- cogs/twitch.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cogs/picarto.py b/cogs/picarto.py index b8aedb0..06b437a 100644 --- a/cogs/picarto.py +++ b/cogs/picarto.py @@ -56,12 +56,14 @@ class Picarto: old_offline_users = {data['member_id']: data for data in picarto if not data['live']} for m_id, result in old_offline_users.items(): + m_id = int(m_id) # Get their url and their user based on that url url = result['picarto_url'] user = re.search("(?<=picarto.tv/)(.*)", url).group(1) # Check if they are online right now if check_online(online_users_list, user): for guild_id in result['servers']: + guild_id = int(guild_id) # Get the channel to send the message to, based on the saved alert's channel guild = self.bot.get_guild(guild_id) if guild is None: @@ -81,12 +83,14 @@ class Picarto: await channel.send(fmt) await utils.update_content('picarto', {'live': 1}, {'member_id': m_id}) for m_id, result in old_online_users.items(): + m_id = int(m_id) # Get their url and their user based on that url url = result['picarto_url'] user = re.search("(?<=picarto.tv/)(.*)", url).group(1) # Check if they are online right now if not check_online(online_users_list, user): for guild_id in result['servers']: + guild_id = int(guild_id) # Get the channel to send the message to, based on the saved alert's channel guild = self.bot.get_guild(guild_id) if guild is None: @@ -170,7 +174,7 @@ class Picarto: EXAMPLE: !picarto add MyUsername RESULT: Your picarto stream is saved, and notifications should go to this guild""" await ctx.message.channel.trigger_typing() - + # This uses a lookbehind to check if picarto.tv exists in the url given # If it does, it matches picarto.tv/user and sets the url as that # Then (in the else) add https://www. to that diff --git a/cogs/twitch.py b/cogs/twitch.py index 929488d..7a3ef97 100644 --- a/cogs/twitch.py +++ b/cogs/twitch.py @@ -49,12 +49,14 @@ class Twitch: online_users = {data['member_id']: data for data in twitch if data['live']} offline_users = {data['member_id']: data for data in twitch if not data['live']} for m_id, result in offline_users.items(): + m_id = int(m_id) # Get their url and their user based on that url url = result['twitch_url'] user = re.search("(?<=twitch.tv/)(.*)", url).group(1) # Check if they are online right now if await self.channel_online(user): for server_id in result['servers']: + server_id = int(server_id) # Get the channel to send the message to, based on the saved alert's channel server = self.bot.get_server(server_id) if server is None: @@ -74,12 +76,14 @@ class Twitch: await channel.send(fmt) await utils.update_content('twitch', {'live': 1}, {'member_id': m_id}) for m_id, result in online_users.items(): + m_id = int(m_id) # Get their url and their user based on that url url = result['twitch_url'] user = re.search("(?<=twitch.tv/)(.*)", url).group(1) # Check if they are online right now if not await self.channel_online(user): for server_id in result['servers']: + server_id = int(server_id) # Get the channel to send the message to, based on the saved alert's channel server = self.bot.get_server(server_id) if server is None: @@ -110,7 +114,7 @@ class Twitch: EXAMPLE: !twitch @OtherPerson RESULT: Information about their twitch URL""" await ctx.message.channel.trigger_typing() - + if member is None: member = ctx.message.author