3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Add anti-raid levels to automod. Large refactor of spam detection. Add member_join and member_join_spam triggers.

Anti-raid levels don't by themselves do anything, but they can be
used in overrides to activate specific automod items.

Spam detection should now be more reliable and also combine further
spam messages after the initial detection into the archive.

Messages deleted by automod no longer create the normal deletion log
entry. Instead, the AUTOMOD_ACTION log entry contains the deleted
message or an archive if there are multiple (i.e. spam).
This commit is contained in:
Dragory 2020-01-26 19:54:32 +02:00
parent dc27821a63
commit 84135b201b
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
14 changed files with 1179 additions and 550 deletions

View file

@ -62,7 +62,10 @@ export function trimPluginDescription(str) {
const inviteCache = new SimpleCache<Promise<Invite>>(10 * MINUTES, 200);
export class ZeppelinPlugin<TConfig extends {} = IBasePluginConfig> extends Plugin<TConfig> {
export class ZeppelinPlugin<
TConfig extends {} = IBasePluginConfig,
TCustomOverrideCriteria extends {} = {}
> extends Plugin<TConfig, TCustomOverrideCriteria> {
public static pluginInfo: PluginInfo;
public static showInDocs: boolean = true;
@ -98,8 +101,11 @@ export class ZeppelinPlugin<TConfig extends {} = IBasePluginConfig> extends Plug
/**
* Wrapper to fetch the real default options from getStaticDefaultOptions()
*/
protected getDefaultOptions(): IPluginOptions<TConfig> {
return (this.constructor as typeof ZeppelinPlugin).getStaticDefaultOptions() as IPluginOptions<TConfig>;
protected getDefaultOptions(): IPluginOptions<TConfig, TCustomOverrideCriteria> {
return (this.constructor as typeof ZeppelinPlugin).getStaticDefaultOptions() as IPluginOptions<
TConfig,
TCustomOverrideCriteria
>;
}
/**
@ -165,14 +171,14 @@ export class ZeppelinPlugin<TConfig extends {} = IBasePluginConfig> extends Plug
/**
* Wrapper that calls mergeAndValidateStaticOptions()
*/
protected getMergedOptions(): IPluginOptions<TConfig> {
protected getMergedOptions(): IPluginOptions<TConfig, TCustomOverrideCriteria> {
if (!this.mergedPluginOptions) {
this.mergedPluginOptions = ((this.constructor as unknown) as typeof ZeppelinPlugin).mergeAndDecodeStaticOptions(
this.pluginOptions,
);
}
return this.mergedPluginOptions as IPluginOptions<TConfig>;
return this.mergedPluginOptions as IPluginOptions<TConfig, TCustomOverrideCriteria>;
}
/**