MaxMessageLimiter Plugin

This plugin implements a hard cap for the amount of messages a member can send within the handlers timeframe before losing send message perms.

class antispam.plugins.MaxMessageLimiter(handler: antispam.anti_spam_handler.AntiSpamHandler, hard_cap: int = 50, message_interval: Optional[int] = None)

This plugin implements a hard cap for the amount of messages a member can send within the handlers timeframe before losing send message perms.

Notes

This only works with the initial message_interval, no updates or guild specifics. If this is something you want let me know on discord and I might make it.

This is also guild wide.

__init__(handler: antispam.anti_spam_handler.AntiSpamHandler, hard_cap: int = 50, message_interval: Optional[int] = None)
Parameters
  • handler (AntiSpamHandler) – The handler to extract cache from

  • hard_cap (int, Optional) –

    The hard cap for the amount of messages you can send within message_interval

    Defaults to 50

  • message_interval (int, Optional) –

    The period of time in milliseconds which messages should be treated as valid.

    Defaults to your AntiSpamHandler options message_interval

async do_punishment(member: antispam.dataclasses.member.Member, message) None

This method gets called and handles punishments, override it to change punishments.

Parameters
  • member (Member) – The member to punish

  • message – A message to get info from

async propagate(message, data: Optional[antispam.dataclasses.core.CorePayload] = None) Any

This method is called whenever the base antispam.propagate is called, adhering to self.is_pre_invoke

Parameters
  • message (Union[discord.Message, hikari.messages.Message]) – The message to run propagation on

  • data (Optional[CorePayload]) – Optional input given to after invoke plugins which is the return value from the main propagate()

Returns

A dictionary of useful data to the end user

Return type

dict