Added support for a list of bot_mod ranks
parent
7699d00fa9
commit
827c501999
|
@ -50,7 +50,7 @@ class Config:
|
||||||
self.status = self.config['Discord']['Status']
|
self.status = self.config['Discord']['Status']
|
||||||
self.prefix = self.config['Discord']['Prefix']
|
self.prefix = self.config['Discord']['Prefix']
|
||||||
self.dynmap_url = self.config['Minecraft']['Dynmap_Url']
|
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.count = int(self.config['Logging']['Count'])
|
||||||
self.rotation_duration = int(self.config['Logging']['Rotation_Duration'])
|
self.rotation_duration = int(self.config['Logging']['Rotation_Duration'])
|
||||||
self.special_name_list = dict(self.config.items('Special Names'))
|
self.special_name_list = dict(self.config.items('Special Names'))
|
||||||
|
|
13
bot.py
13
bot.py
|
@ -122,14 +122,13 @@ async def username_update():
|
||||||
|
|
||||||
|
|
||||||
def start_bot():
|
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:
|
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())
|
bot.loop.create_task(username_update())
|
||||||
logger.info('Logging into Discord...')
|
logger.info('Logging into Discord...')
|
||||||
bot.run(bot_config.token)
|
bot.run(bot_config.token)
|
||||||
|
|
|
@ -9,7 +9,7 @@ from bot import bot_commands
|
||||||
def check_mod(user):
|
def check_mod(user):
|
||||||
try:
|
try:
|
||||||
for role in user.roles:
|
for role in user.roles:
|
||||||
if role.id == bot_config.bot_mod:
|
if role.id in bot_config.bot_mod:
|
||||||
return True
|
return True
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise NotOnServerError
|
raise NotOnServerError
|
||||||
|
|
Loading…
Reference in New Issue