A cool plugin designed to assist you when dealing with mass mentions.
- class antispam.plugins.MassMentionPunishment(member_id: int, guild_id: int, channel_id: int, is_overall_punishment: bool)¶
This dataclass is what is dispatched when someone should be punished for mention spam.
You shouldn’t be making instances of this.
- class antispam.plugins.AntiMassMention(bot, handler: antispam.anti_spam_handler.AntiSpamHandler, *, total_mentions_before_punishment: int = 10, time_period: int = 15000, min_mentions_per_message: int = 5)¶
In order to check if you should punish someone, see the below code.
1data = await AntiSpamHandler.propagate(message) 2return_item: Union[dict, MassMentionPunishment] = data.after_invoke_plugins["AntiMassMention"] 3 4if isinstance(return_item, MassMentionPunishment): 5 # Punish for mention spam
- __init__(bot, handler: antispam.anti_spam_handler.AntiSpamHandler, *, total_mentions_before_punishment: int = 10, time_period: int = 15000, min_mentions_per_message: int = 5)¶
bot – Our bot instance
handler (AntiSpamHandler) – Our AntiSpamHandler instance
total_mentions_before_punishment (int) – How many mentions within the time period before we punish the user Inclusive
time_period (int) – The time period valid for mentions Is in milliseconds
min_mentions_per_message (int) – The minimum amount of mentions in a message before a punishment is issued Inclusive
- async propagate(message) Union[dict, antispam.plugins.anti_mass_mention.MassMentionPunishment] ¶
Manages and stores any mass mentions per users
message – The message to interact with
dict – A dictionary explaining what actions have been taken
MassMentionPunishment – Data surrounding the punishment you should be doing.