mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-07 19:17:19 +00:00
Merge branch '240811_application_commands_merge_2' into next
This commit is contained in:
commit
43b8017985
279 changed files with 6192 additions and 3044 deletions
|
@ -8,6 +8,7 @@ import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners.js";
|
|||
import { MINUTES, SECONDS } from "../../utils.js";
|
||||
import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap.js";
|
||||
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap.js";
|
||||
import { CommonPlugin } from "../Common/CommonPlugin.js";
|
||||
import { CountersPlugin } from "../Counters/CountersPlugin.js";
|
||||
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin.js";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin.js";
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ export const BanAction = automodAction({
|
|||
await modActions.banUserId(
|
||||
userId,
|
||||
reason,
|
||||
reason,
|
||||
{
|
||||
contactMethods,
|
||||
caseArgs,
|
||||
|
|
|
@ -33,7 +33,7 @@ export const KickAction = automodAction({
|
|||
const modActions = pluginData.getPlugin(ModActionsPlugin);
|
||||
for (const member of membersToKick) {
|
||||
if (!member) continue;
|
||||
await modActions.kickMember(member, reason, { contactMethods, caseArgs, isAutomodAction: true });
|
||||
await modActions.kickMember(member, reason, reason, { contactMethods, caseArgs, isAutomodAction: true });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -57,6 +57,7 @@ export const MuteAction = automodAction({
|
|||
userId,
|
||||
duration,
|
||||
reason,
|
||||
reason,
|
||||
{ contactMethods, caseArgs, isAutomodAction: true },
|
||||
rolesToRemove,
|
||||
rolesToRestore,
|
||||
|
|
|
@ -33,7 +33,7 @@ export const WarnAction = automodAction({
|
|||
const modActions = pluginData.getPlugin(ModActionsPlugin);
|
||||
for (const member of membersToWarn) {
|
||||
if (!member) continue;
|
||||
await modActions.warnMember(member, reason, { contactMethods, caseArgs, isAutomodAction: true });
|
||||
await modActions.warnMember(member, reason, reason, { contactMethods, caseArgs, isAutomodAction: true });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { guildPluginMessageCommand } from "knub";
|
||||
import { sendSuccessMessage } from "../../../pluginUtils.js";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
|
@ -9,6 +8,6 @@ export const AntiraidClearCmd = guildPluginMessageCommand<AutomodPluginType>()({
|
|||
|
||||
async run({ pluginData, message }) {
|
||||
await setAntiraidLevel(pluginData, null, message.author);
|
||||
sendSuccessMessage(pluginData, message.channel, "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.js";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
|
@ -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)) {
|
||||
sendErrorMessage(pluginData, message.channel, "Unknown anti-raid level");
|
||||
pluginData.state.common.sendErrorMessage(message, "Unknown anti-raid level");
|
||||
return;
|
||||
}
|
||||
|
||||
await setAntiraidLevel(pluginData, args.level, message.author);
|
||||
sendSuccessMessage(pluginData, message.channel, `Anti-raid level set to **${args.level}**`);
|
||||
pluginData.state.common.sendSuccessMessage(message, `Anti-raid level set to **${args.level}**`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { guildPluginEventListener } from "knub";
|
||||
import diff from "lodash/difference.js";
|
||||
import isEqual from "lodash/isEqual.js";
|
||||
import diff from "lodash.difference";
|
||||
import isEqual from "lodash.isequal";
|
||||
import { runAutomod } from "../functions/runAutomod.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
|
|
|
@ -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.js";
|
||||
import { RegExpRunner } from "../../RegExpRunner.js";
|
||||
|
@ -9,6 +9,7 @@ import { GuildLogs } from "../../data/GuildLogs.js";
|
|||
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
|
||||
import { SavedMessage } from "../../data/entities/SavedMessage.js";
|
||||
import { entries, zBoundedRecord, zDelayString } from "../../utils.js";
|
||||
import { CommonPlugin } from "../Common/CommonPlugin.js";
|
||||
import { CounterEvents } from "../Counters/types.js";
|
||||
import { ModActionType, ModActionsEvents } from "../ModActions/types.js";
|
||||
import { MutesEvents } from "../Mutes/types.js";
|
||||
|
@ -140,6 +141,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