fix (LionModule): Fix channel existence ward.

Fixes an issue where all commands would fail in DMs.
This commit is contained in:
2021-12-22 08:14:32 +02:00
parent e8547f9f4b
commit 73e329ee94

View File

@@ -81,15 +81,15 @@ class LionModule(Module):
pass pass
raise SafeCancellation(details="Module '{}' is not ready.".format(self.name)) raise SafeCancellation(details="Module '{}' is not ready.".format(self.name))
# Check that the channel and guild still exists
if not ctx.client.get_guild(ctx.guild.id) or not ctx.guild.get_channel(ctx.ch.id):
raise SafeCancellation(details='Command channel is no longer reachable.')
# Check global user blacklist # Check global user blacklist
if ctx.author.id in ctx.client.objects['blacklisted_users']: if ctx.author.id in ctx.client.objects['blacklisted_users']:
raise SafeCancellation(details='User is blacklisted.') raise SafeCancellation(details='User is blacklisted.')
if ctx.guild: if ctx.guild:
# Check that the channel and guild still exists
if not ctx.client.get_guild(ctx.guild.id) or not ctx.guild.get_channel(ctx.ch.id):
raise SafeCancellation(details='Command channel is no longer reachable.')
# Check global guild blacklist # Check global guild blacklist
if ctx.guild.id in ctx.client.objects['blacklisted_guilds']: if ctx.guild.id in ctx.client.objects['blacklisted_guilds']:
raise SafeCancellation(details='Guild is blacklisted.') raise SafeCancellation(details='Guild is blacklisted.')