Fix a variable 'roles' referenced before assignment error when relying on default fallback.

This commit is contained in:
noirscape 2021-01-08 23:37:37 +01:00
parent 24182b11ca
commit 9b3a442699

View file

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