Merge pull request #77 from noirscape/roles-accessed-too-early

Fix a variable 'roles' referenced before assignment error when relying on default fallback.
This commit is contained in:
Ave 2021-01-09 01:43:55 +03:00 committed by GitHub
commit 586c6239b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,6 +37,7 @@ class Lockdown(Cog):
channel = ctx.channel
log_channel = self.bot.get_channel(config.modlog_channel)
roles = None
for key, lockdown_conf in config.lockdown_configs.items():
if channel.id in lockdown_conf["channels"]:
roles = lockdown_conf["roles"]
@ -76,6 +77,7 @@ class Lockdown(Cog):
channel = ctx.channel
log_channel = self.bot.get_channel(config.modlog_channel)
roles = None
for key, lockdown_conf in config.lockdown_configs.items():
if channel.id in lockdown_conf["channels"]:
roles = lockdown_conf["roles"]