From 25094c60768fcd8906509253b12895b1ba8a213f Mon Sep 17 00:00:00 2001 From: Red-GitHubBot <88117545+Red-GitHubBot@users.noreply.github.com> Date: Wed, 19 Apr 2023 23:58:40 +0200 Subject: [PATCH] [3.4] [Mod] Account for roles in mention spam (#5388) (#6056) Co-authored-by: Vexed Co-authored-by: Kowlin <10947836+Kowlin@users.noreply.github.com> --- redbot/cogs/mod/events.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/redbot/cogs/mod/events.py b/redbot/cogs/mod/events.py index 80b742b97..199006ef5 100644 --- a/redbot/cogs/mod/events.py +++ b/redbot/cogs/mod/events.py @@ -46,12 +46,12 @@ class Events(MixinMeta): mention_spam = await self.config.guild(guild).mention_spam.all() if mention_spam["strict"]: # if strict is enabled - mentions = message.raw_mentions + mentions = len(message.raw_mentions) + len(message.raw_role_mentions) else: # if not enabled - mentions = set(message.mentions) + mentions = len(set(message.mentions)) + len(set(message.role_mentions)) if mention_spam["ban"]: - if len(mentions) >= mention_spam["ban"]: + if mentions >= mention_spam["ban"]: try: await guild.ban(author, reason=_("Mention spam (Autoban)")) except discord.HTTPException: @@ -75,7 +75,7 @@ class Events(MixinMeta): return True if mention_spam["kick"]: - if len(mentions) >= mention_spam["kick"]: + if mentions >= mention_spam["kick"]: try: await guild.kick(author, reason=_("Mention Spam (Autokick)")) except discord.HTTPException: @@ -99,7 +99,7 @@ class Events(MixinMeta): return True if mention_spam["warn"]: - if len(mentions) >= mention_spam["warn"]: + if mentions >= mention_spam["warn"]: try: await author.send(_("Please do not mass mention people!")) except (discord.HTTPException, discord.Forbidden):