AdminLogs Plugin

A plugin design to save admins hassle with regard to evidence collection on automated punishments.

Simply register this as a plugin, and it will save the relevant information for all punishments to a text file.

class antispam.plugins.AdminLogs(handler: antispam.anti_spam_handler.AntiSpamHandler, log_location: str, punishment_type: Optional[Union[str, Callable]] = None)

A plugin design to save admins hassle with regard to evidence collection on automated punishments.

__init__(handler: antispam.anti_spam_handler.AntiSpamHandler, log_location: str, punishment_type: Optional[Union[str, Callable]] = None)
Parameters
  • handler (AntiSpamHandler) – Our AntiSpamHandler instance

  • log_location (str) – The directory to store logs in, relative from the caller location. This directory should be empty or only contain previous output from this plugin.

  • punishment_type (Optional[Union[str, Callable]]) –

    This will be used if sending logs for custom punishments.

    You can also provide a Callable which should return a string to be used as the punishment type. This function will be called with 2 arguments. Argument 1 is the message, argument 2 is CorePayload

Notes

This will save transcripts for every punishment, but it only sends ones to discord if the Guild has a log_channel_id set.

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
Returns

A dictionary of useful data to the end user

Return type

dict