mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-07 19:17:19 +00:00
Fixes, refactoring and PR feedback
This commit is contained in:
parent
0be54912c4
commit
893a77d562
202 changed files with 1037 additions and 1069 deletions
|
@ -32,6 +32,7 @@ import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChang
|
|||
import { clearOldRecentActions } from "./functions/clearOldRecentActions";
|
||||
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam";
|
||||
import { AutomodPluginType, zAutomodConfig } from "./types";
|
||||
import { CommonPlugin } from "../Common/CommonPlugin";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
@ -117,6 +118,10 @@ export const AutomodPlugin = guildPlugin<AutomodPluginType>()({
|
|||
state.cachedAntiraidLevel = await state.antiraidLevels.get();
|
||||
},
|
||||
|
||||
beforeStart(pluginData) {
|
||||
pluginData.state.common = pluginData.getPlugin(CommonPlugin);
|
||||
},
|
||||
|
||||
async afterLoad(pluginData) {
|
||||
const { state } = pluginData;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { guildPluginMessageCommand } from "knub";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||
import { AutomodPluginType } from "../types";
|
||||
|
||||
|
@ -9,6 +8,6 @@ export const AntiraidClearCmd = guildPluginMessageCommand<AutomodPluginType>()({
|
|||
|
||||
async run({ pluginData, message }) {
|
||||
await setAntiraidLevel(pluginData, null, message.author);
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(message, "Anti-raid turned **off**");
|
||||
void pluginData.state.common.sendSuccessMessage(message, "Anti-raid turned **off**");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { guildPluginMessageCommand } from "knub";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||
import { AutomodPluginType } from "../types";
|
||||
|
||||
|
@ -15,11 +14,11 @@ export const SetAntiraidCmd = guildPluginMessageCommand<AutomodPluginType>()({
|
|||
async run({ pluginData, message, args }) {
|
||||
const config = pluginData.config.get();
|
||||
if (!config.antiraid_levels.includes(args.level)) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, "Unknown anti-raid level");
|
||||
pluginData.state.common.sendErrorMessage(message, "Unknown anti-raid level");
|
||||
return;
|
||||
}
|
||||
|
||||
await setAntiraidLevel(pluginData, args.level, message.author);
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(message, `Anti-raid level set to **${args.level}**`);
|
||||
pluginData.state.common.sendSuccessMessage(message, `Anti-raid level set to **${args.level}**`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildMember, GuildTextBasedChannel, PartialGuildMember, ThreadChannel, User } from "discord.js";
|
||||
import { BasePluginType, CooldownManager } from "knub";
|
||||
import { BasePluginType, CooldownManager, pluginUtils } from "knub";
|
||||
import z from "zod";
|
||||
import { Queue } from "../../Queue";
|
||||
import { RegExpRunner } from "../../RegExpRunner";
|
||||
|
@ -17,6 +17,7 @@ import { RecentActionType } from "./constants";
|
|||
import { availableTriggers } from "./triggers/availableTriggers";
|
||||
|
||||
import Timeout = NodeJS.Timeout;
|
||||
import { CommonPlugin } from "../Common/CommonPlugin";
|
||||
|
||||
export type ZTriggersMapHelper = {
|
||||
[TriggerName in keyof typeof availableTriggers]: (typeof availableTriggers)[TriggerName]["configSchema"];
|
||||
|
@ -139,6 +140,8 @@ export interface AutomodPluginType extends BasePluginType {
|
|||
|
||||
modActionsListeners: Map<keyof ModActionsEvents, any>;
|
||||
mutesListeners: Map<keyof MutesEvents, any>;
|
||||
|
||||
common: pluginUtils.PluginPublicInterface<typeof CommonPlugin>;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue