aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Amrou Bellalouna <[email protected]>2023-03-20 17:53:44 +0100
committerGravatar GitHub <[email protected]>2023-03-20 16:53:44 +0000
commita7002536d3635dd9c5b47a54f48bf3e452a35c19 (patch)
tree7f46c34168acea8893a43b9989b5f764ee9d491d
parentMerge pull request #2476 from python-discord/remove_muted_role (diff)
Override context command explicitly in antispam filter(#2477)
-rw-r--r--bot/exts/filters/antispam.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bot/exts/filters/antispam.py b/bot/exts/filters/antispam.py
index 70a9c00b8..0d02edabf 100644
--- a/bot/exts/filters/antispam.py
+++ b/bot/exts/filters/antispam.py
@@ -232,12 +232,14 @@ class AntiSpam(Cog):
# Get context and make sure the bot becomes the actor of infraction by patching the `author` attributes
context = await self.bot.get_context(msg)
- context.author = self.bot.user
+ command = self.bot.get_command("timeout")
+ context.author = context.guild.get_member(self.bot.user.id)
+ context.command = command
# Since we're going to invoke the timeout command directly, we need to manually call the converter.
dt_remove_role_after = await self.expiration_date_converter.convert(context, f"{remove_timeout_after}S")
await context.invoke(
- self.bot.get_command('timeout'),
+ command,
member,
dt_remove_role_after,
reason=reason