Custom Events

This package utilises custom discord.py events for punishments. This system will be further rolled out down the line to the standard lib.

Anti Mass Mentions

1
2
3
4
5
from antispam.ext import MassMentionPunishment

@bot.event
async def on_mass_mention_punishment(payload: MassMentionPunishment):
    # Your code here

The payload is an instance of the following:

class antispam.ext.anti_mass_mention.MassMentionPunishment(user_id: int, guild_id: int, is_overall_punishment: bool)

This dataclass is what is dispatched to on_mass_mention_punishment

Parameters:
  • user_id (int) – The associated users id
  • guild_id (int) – The associated guilds id
  • is_overall_punishment (bool) – If this is True, it means the user has exceeded total_mentions_before_punishment. Otherwise they have exceeded min_mentions_per_message