mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 04:25:01 +00:00
automod: add triggers for mod actions
This commit is contained in:
parent
5ffc3e7cc4
commit
93912541b4
34 changed files with 412 additions and 3 deletions
|
@ -39,6 +39,10 @@ import { DeleteCaseCmd } from "./commands/DeleteCaseCmd";
|
|||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { GuildTempbans } from "../../data/GuildTempbans";
|
||||
import { outdatedTempbansLoop } from "./functions/outdatedTempbansLoop";
|
||||
import { EventEmitter } from "events";
|
||||
import { mapToPublicFn } from "../../pluginUtils";
|
||||
import { onModActionsEvent } from "./functions/onModActionsEvent";
|
||||
import { offModActionsEvent } from "./functions/offModActionsEvent";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
@ -165,6 +169,12 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()("mod
|
|||
banUserId(pluginData, userId, reason, banOptions);
|
||||
};
|
||||
},
|
||||
|
||||
on: mapToPublicFn(onModActionsEvent),
|
||||
off: mapToPublicFn(offModActionsEvent),
|
||||
getEventEmitter(pluginData) {
|
||||
return () => pluginData.state.events;
|
||||
},
|
||||
},
|
||||
|
||||
onLoad(pluginData) {
|
||||
|
@ -179,10 +189,13 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()("mod
|
|||
state.outdatedTempbansTimeout = null;
|
||||
state.ignoredEvents = [];
|
||||
|
||||
state.events = new EventEmitter();
|
||||
|
||||
outdatedTempbansLoop(pluginData);
|
||||
},
|
||||
|
||||
onUnload(pluginData) {
|
||||
pluginData.state.unloaded = true;
|
||||
pluginData.state.events.removeAllListeners();
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue