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, save_all_transcripts: bool = True)¶
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, save_all_transcripts: bool = True)¶
- 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 isCorePayload
save_all_transcripts (bool) –
Whether or not to save all transcripts regardless of if log channel is set for the guild in question.
Defaults to True
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 toself.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