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

Convert id's to int

This commit is contained in:
Phxntxm 2017-03-12 16:46:43 -05:00
parent 1e535a3842
commit 1473dc9e67
2 changed files with 10 additions and 2 deletions

View file

@ -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

View file

@ -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