Plugin Class Schema¶
All plugins that aim to be used as a registered
have at least the following class layout.
All registered plugins must subclass
1from antispam import BasePlugin 2 3class Placeholder(BasePlugin): 4 def __init__(self): 5 self.is_pre_invoke = True 6 7 async def propagate(self, message: discord.Message) -> dict: 8 # Do your code stuff here
self.is_pre_invoke is optional assuming your extension is using
a pre-invoke due to the nature of the implementation.
1from antispam import BasePlugin 2 3class Placeholder(BasePlugin): 4 def __init__(self): 5 self.is_pre_invoke = False 6 7 async def propagate(self, message: discord.Message, propagate_data: CorePayload) -> dict: 8 # Do your code stuff here
The only difference between these two schema’s, outside of
being different, is that the after-invoke method will also be given an
extra argument which is the data returned by
If a key called
the return data from any extension,
will immediately return without executing any remaining extensions
Say you want to use AntiSpamHandler, but only if the message doesnt
contain a secret word. You would create a pre-invoke extension, and
if the secret word is said you would set
True and then
AntiSpamHandler would ignore that message.
Thats quite cool aint it! Woop woop