Convert id's to int
This commit is contained in:
parent
1e535a3842
commit
1473dc9e67
|
@ -56,12 +56,14 @@ class Picarto:
|
||||||
old_offline_users = {data['member_id']: data for data in picarto if not data['live']}
|
old_offline_users = {data['member_id']: data for data in picarto if not data['live']}
|
||||||
|
|
||||||
for m_id, result in old_offline_users.items():
|
for m_id, result in old_offline_users.items():
|
||||||
|
m_id = int(m_id)
|
||||||
# Get their url and their user based on that url
|
# Get their url and their user based on that url
|
||||||
url = result['picarto_url']
|
url = result['picarto_url']
|
||||||
user = re.search("(?<=picarto.tv/)(.*)", url).group(1)
|
user = re.search("(?<=picarto.tv/)(.*)", url).group(1)
|
||||||
# Check if they are online right now
|
# Check if they are online right now
|
||||||
if check_online(online_users_list, user):
|
if check_online(online_users_list, user):
|
||||||
for guild_id in result['servers']:
|
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
|
# Get the channel to send the message to, based on the saved alert's channel
|
||||||
guild = self.bot.get_guild(guild_id)
|
guild = self.bot.get_guild(guild_id)
|
||||||
if guild is None:
|
if guild is None:
|
||||||
|
@ -81,12 +83,14 @@ class Picarto:
|
||||||
await channel.send(fmt)
|
await channel.send(fmt)
|
||||||
await utils.update_content('picarto', {'live': 1}, {'member_id': m_id})
|
await utils.update_content('picarto', {'live': 1}, {'member_id': m_id})
|
||||||
for m_id, result in old_online_users.items():
|
for m_id, result in old_online_users.items():
|
||||||
|
m_id = int(m_id)
|
||||||
# Get their url and their user based on that url
|
# Get their url and their user based on that url
|
||||||
url = result['picarto_url']
|
url = result['picarto_url']
|
||||||
user = re.search("(?<=picarto.tv/)(.*)", url).group(1)
|
user = re.search("(?<=picarto.tv/)(.*)", url).group(1)
|
||||||
# Check if they are online right now
|
# Check if they are online right now
|
||||||
if not check_online(online_users_list, user):
|
if not check_online(online_users_list, user):
|
||||||
for guild_id in result['servers']:
|
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
|
# Get the channel to send the message to, based on the saved alert's channel
|
||||||
guild = self.bot.get_guild(guild_id)
|
guild = self.bot.get_guild(guild_id)
|
||||||
if guild is None:
|
if guild is None:
|
||||||
|
@ -170,7 +174,7 @@ class Picarto:
|
||||||
EXAMPLE: !picarto add MyUsername
|
EXAMPLE: !picarto add MyUsername
|
||||||
RESULT: Your picarto stream is saved, and notifications should go to this guild"""
|
RESULT: Your picarto stream is saved, and notifications should go to this guild"""
|
||||||
await ctx.message.channel.trigger_typing()
|
await ctx.message.channel.trigger_typing()
|
||||||
|
|
||||||
# This uses a lookbehind to check if picarto.tv exists in the url given
|
# 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
|
# If it does, it matches picarto.tv/user and sets the url as that
|
||||||
# Then (in the else) add https://www. to that
|
# Then (in the else) add https://www. to that
|
||||||
|
|
|
@ -49,12 +49,14 @@ class Twitch:
|
||||||
online_users = {data['member_id']: data for data in twitch if data['live']}
|
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']}
|
offline_users = {data['member_id']: data for data in twitch if not data['live']}
|
||||||
for m_id, result in offline_users.items():
|
for m_id, result in offline_users.items():
|
||||||
|
m_id = int(m_id)
|
||||||
# Get their url and their user based on that url
|
# Get their url and their user based on that url
|
||||||
url = result['twitch_url']
|
url = result['twitch_url']
|
||||||
user = re.search("(?<=twitch.tv/)(.*)", url).group(1)
|
user = re.search("(?<=twitch.tv/)(.*)", url).group(1)
|
||||||
# Check if they are online right now
|
# Check if they are online right now
|
||||||
if await self.channel_online(user):
|
if await self.channel_online(user):
|
||||||
for server_id in result['servers']:
|
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
|
# Get the channel to send the message to, based on the saved alert's channel
|
||||||
server = self.bot.get_server(server_id)
|
server = self.bot.get_server(server_id)
|
||||||
if server is None:
|
if server is None:
|
||||||
|
@ -74,12 +76,14 @@ class Twitch:
|
||||||
await channel.send(fmt)
|
await channel.send(fmt)
|
||||||
await utils.update_content('twitch', {'live': 1}, {'member_id': m_id})
|
await utils.update_content('twitch', {'live': 1}, {'member_id': m_id})
|
||||||
for m_id, result in online_users.items():
|
for m_id, result in online_users.items():
|
||||||
|
m_id = int(m_id)
|
||||||
# Get their url and their user based on that url
|
# Get their url and their user based on that url
|
||||||
url = result['twitch_url']
|
url = result['twitch_url']
|
||||||
user = re.search("(?<=twitch.tv/)(.*)", url).group(1)
|
user = re.search("(?<=twitch.tv/)(.*)", url).group(1)
|
||||||
# Check if they are online right now
|
# Check if they are online right now
|
||||||
if not await self.channel_online(user):
|
if not await self.channel_online(user):
|
||||||
for server_id in result['servers']:
|
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
|
# Get the channel to send the message to, based on the saved alert's channel
|
||||||
server = self.bot.get_server(server_id)
|
server = self.bot.get_server(server_id)
|
||||||
if server is None:
|
if server is None:
|
||||||
|
@ -110,7 +114,7 @@ class Twitch:
|
||||||
EXAMPLE: !twitch @OtherPerson
|
EXAMPLE: !twitch @OtherPerson
|
||||||
RESULT: Information about their twitch URL"""
|
RESULT: Information about their twitch URL"""
|
||||||
await ctx.message.channel.trigger_typing()
|
await ctx.message.channel.trigger_typing()
|
||||||
|
|
||||||
if member is None:
|
if member is None:
|
||||||
member = ctx.message.author
|
member = ctx.message.author
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue