Check admin: now also accepts bot owner

This commit is contained in:
Elnath 2020-12-26 22:32:09 +01:00
parent 4861d7b2ed
commit ddc4690ee5
1 changed files with 5 additions and 3 deletions

View File

@ -25,10 +25,10 @@ class VocalMaisBot(discord.Client):
except json.JSONDecodeError as e:
logger.critical(f"Impossible to parse watched channels file, JSON error: {e}")
sys.exit(1)
self.owner = None # Fetched by on_ready
@staticmethod
async def _check_administrator_for_command(message: discord.Message) -> bool:
if message.author.guild_permissions.administrator:
async def _check_administrator_for_command(self, message: discord.Message) -> bool:
if message.author.guild_permissions.administrator or message.author == self.owner:
return True
else:
await message.channel.send(f":dragon_face: Only an administrator can control me!")
@ -49,6 +49,8 @@ class VocalMaisBot(discord.Client):
logger.info("Connected and ready!")
logger.debug(f"Logged as {self.user}")
self.owner = (await self.application_info()).owner
oauth_url = discord.utils.oauth_url(
self.user.id,
discord.Permissions(manage_channels = True, read_messages = True, send_messages = True, move_members = True)