Browse Source

Merge remote-tracking branch 'origin/master'

master
DrBot7 4 years ago
parent
commit
b17224f257
  1. 1
      README.md
  2. 1
      bot.py
  3. 21
      cogs/linking_panel.py

1
README.md

@ -1,4 +1,5 @@
# Botflop # Botflop
[Click here](https://discord.com/api/oauth2/authorize?client_id=787929894616825867&permissions=0&scope=bot) to invite Botflop to your server
# Current abilities # Current abilities
## Analyze timings reports ## Analyze timings reports

1
bot.py

@ -133,6 +133,7 @@ async def on_raw_reaction_add(payload):
@bot.command() @bot.command()
async def ping(ctx): async def ping(ctx):
if running_on_panel: if running_on_panel:
if guild_id == ctx.guild.id:
await ctx.send(f'Private bot ping is {round(bot.latency * 1000)}ms') await ctx.send(f'Private bot ping is {round(bot.latency * 1000)}ms')
if not running_on_panel: if not running_on_panel:
await ctx.send(f'Public bot ping is {round(bot.latency * 1000)}ms') await ctx.send(f'Public bot ping is {round(bot.latency * 1000)}ms')

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