Added support for a list of bot_mod ranks

doc_update
Joey Hines 2018-08-14 18:56:07 -05:00
parent 7699d00fa9
commit 827c501999
3 changed files with 8 additions and 9 deletions

View File

@ -50,7 +50,7 @@ class Config:
self.status = self.config['Discord']['Status']
self.prefix = self.config['Discord']['Prefix']
self.dynmap_url = self.config['Minecraft']['Dynmap_Url']
self.bot_mod = self.config['Discord']['Bot_Mod']
self.bot_mod = self.config['Discord']['Bot_Mod'].split(',')
self.count = int(self.config['Logging']['Count'])
self.rotation_duration = int(self.config['Logging']['Rotation_Duration'])
self.special_name_list = dict(self.config.items('Special Names'))

13
bot.py
View File

@ -122,14 +122,13 @@ async def username_update():
def start_bot():
for extension in extensions:
try:
bot.load_extension(extension)
except Exception as e:
logger.info('Failed to load extension {}, {}'.format(extension, e))
try:
for extension in extensions:
try:
bot.load_extension(extension)
except Exception as e:
logger.info('Failed to load extension {}'.format(extension))
raise e
bot.loop.create_task(username_update())
logger.info('Logging into Discord...')
bot.run(bot_config.token)

View File

@ -9,7 +9,7 @@ from bot import bot_commands
def check_mod(user):
try:
for role in user.roles:
if role.id == bot_config.bot_mod:
if role.id in bot_config.bot_mod:
return True
except AttributeError:
raise NotOnServerError