diff options
| author | 2022-10-01 00:49:00 +0300 | |
|---|---|---|
| committer | 2022-10-01 00:49:00 +0300 | |
| commit | 8bb8b45f0bce5bd2a8b69e5372d6c065e9dbb2bd (patch) | |
| tree | 8e16d42f7239eed213645efd484f2576e3628a40 | |
| parent | Properly remove items from sequence edit (diff) | |
Correctly handle DMs
| -rw-r--r-- | bot/exts/filtering/_settings_types/actions/delete_messages.py | 6 | ||||
| -rw-r--r-- | bot/exts/filtering/_settings_types/validations/channel_scope.py | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/bot/exts/filtering/_settings_types/actions/delete_messages.py b/bot/exts/filtering/_settings_types/actions/delete_messages.py index 710cb0ed8..d1ddf8241 100644 --- a/bot/exts/filtering/_settings_types/actions/delete_messages.py +++ b/bot/exts/filtering/_settings_types/actions/delete_messages.py @@ -22,9 +22,11 @@ class DeleteMessages(ActionEntry): if not self.delete_messages or ctx.event not in (Event.MESSAGE, Event.MESSAGE_EDIT): return + if not ctx.message.guild: + return + with suppress(NotFound): - if ctx.message.guild: - await ctx.message.delete() + await ctx.message.delete() ctx.action_descriptions.append("deleted") def __or__(self, other: ActionEntry): diff --git a/bot/exts/filtering/_settings_types/validations/channel_scope.py b/bot/exts/filtering/_settings_types/validations/channel_scope.py index fd5206b81..be1061199 100644 --- a/bot/exts/filtering/_settings_types/validations/channel_scope.py +++ b/bot/exts/filtering/_settings_types/validations/channel_scope.py @@ -49,6 +49,10 @@ class ChannelScope(ValidationEntry): If the channel is explicitly enabled, it bypasses the set disabled channels and categories. """ channel = ctx.channel + + if channel.guild is None: # This is a DM channel, outside the scope of this setting. + return True + enabled_id = ( channel.id in self.enabled_channels or ( |