Browse Source

Update linking_panel.py

master
Purpur 4 years ago
committed by GitHub
parent
commit
b4d6221c46
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      cogs/linking_panel.py

21
cogs/linking_panel.py

@ -25,7 +25,11 @@ class Linking(commands.Cog):
@commands.Cog.listener() @commands.Cog.listener()
async def on_message(self, message): async def on_message(self, message):
if message.author != self.bot.user and message.guild is None:
self.guild = self.bot.get_guild(self.guild_id)
if message.author != self.bot.user and message.guild is None and self.guild.get_member(message.author.id) is not None:
if "://" in message.content:
return
if self.guild in message.author.guilds:
channel = message.channel channel = message.channel
await channel.send("Processing, please wait...") await channel.send("Processing, please wait...")
# Potential API key, so tries it out # Potential API key, so tries it out
@ -76,8 +80,7 @@ class Linking(commands.Cog):
file.write(json_dumps) file.write(json_dumps)
file.close() file.close()
guild = self.bot.get_guild(self.guild_id)
member = guild.get_member(message.author.id)
member = self.guild.get_member(message.author.id)
if member: if member:
url = "https://panel.birdflop.com/api/client" url = "https://panel.birdflop.com/api/client"
@ -115,21 +118,21 @@ class Linking(commands.Cog):
elif server_node == "Elktail - EU": elif server_node == "Elktail - EU":
user_elktail = True user_elktail = True
if user_client: if user_client:
role = discord.utils.get(guild.roles, id=self.client_role_id)
role = discord.utils.get(self.guild.roles, id=self.client_role_id)
await member.add_roles(role) await member.add_roles(role)
if user_subuser: if user_subuser:
role = discord.utils.get(guild.roles, id=self.subuser_role_id)
role = discord.utils.get(self.guild.roles, id=self.subuser_role_id)
await member.add_roles(role) await member.add_roles(role)
if user_crabwings: if user_crabwings:
role = discord.utils.get(guild.roles, id=self.crabwings_role_id)
role = discord.utils.get(self.guild.roles, id=self.crabwings_role_id)
await member.add_roles(role) await member.add_roles(role)
if user_duckfeet: if user_duckfeet:
role = discord.utils.get(guild.roles, id=self.duckfeet_role_id)
role = discord.utils.get(self.guild.roles, id=self.duckfeet_role_id)
await member.add_roles(role) await member.add_roles(role)
if user_elktail: if user_elktail:
role = discord.utils.get(guild.roles, id=self.elktail_role_id)
role = discord.utils.get(self.guild.roles, id=self.elktail_role_id)
await member.add_roles(role) await member.add_roles(role)
role = discord.utils.get(guild.roles, id=self.verified_role_id)
role = discord.utils.get(self.guild.roles, id=self.verified_role_id)
await member.add_roles(role) await member.add_roles(role)
await channel.send( await channel.send(

Loading…
Cancel
Save