Update bot_management.py

This commit is contained in:
davfsa 2018-06-21 20:19:16 +02:00 committed by GitHub
parent fe143678fe
commit 776b8d009c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,10 +10,14 @@ class BotManager:
if member.bot is False:
return
else:
# The member is a bot
bot_owner = member.guild.get_member((await self.bot.db_con.fetchval('select owner from bots where id = $1', member.id))
await bot_owner.add_roles(discord.utils.get(member.guild.roles, name='Bot Developers'))
# Checks if the bot is in the database
if await self.bot.db_con.fetch('select count(*) from bots where id = $1', member.id) != 1:
return await member.kick()
bot_owner = member.guild.get_member((await self.bot.db_con.fetchval('select owner from bots where id = $1', member.id))
await bot_owner.send("Your bot has been approved and invited")
await bot_owner.add_roles(discord.utils.get(member.guild.roles, name='Bot Developers'))
await member.add_roles(discord.utils.get(member.guild.roles, name='Bots'))
try:
await member.edit(nick='[' + await self.bot.db_con.fetchval('select prefix from bots where id = $1', member.id)