Allow the bot to work with not having Administrator permissions (#47)

This commit is contained in:
Jeremy "EndenDragon" Zhang
2017-09-06 17:59:22 -07:00
committed by GitHub
parent 21400679b6
commit 600627d2e2
7 changed files with 117 additions and 88 deletions

View File

@ -98,7 +98,10 @@ class DatabaseInterface(object):
session.commit()
async def update_guild(self, guild):
server_webhooks = await self.bot.get_server_webhooks(guild)
if guild.me.server_permissions.manage_webhooks:
server_webhooks = await self.bot.get_server_webhooks(guild)
else:
server_webhooks = []
async with threadpool():
with self.get_session() as session:
gui = session.query(Guilds).filter(Guilds.guild_id == guild.id).first()