3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 13:55:03 +00:00

Fixes, refactoring and PR feedback

This commit is contained in:
Lily Bergonzat 2024-04-15 15:51:45 +02:00
parent 0be54912c4
commit 893a77d562
202 changed files with 1037 additions and 1069 deletions

View file

@ -3,8 +3,7 @@ import { slashOptions } from "knub";
import { hasPermission } from "../../../../pluginUtils";
import { UserNotificationMethod, convertDelayStringToMS, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { CommonPlugin } from "../../../Common/CommonPlugin";
import { actualMuteCmd } from "../../functions/actualCommands/actualMuteCmd";
import { actualMuteCmd } from "../mute/actualMuteCmd";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs";
import { modActionsSlashCmd } from "../../types";
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
@ -47,9 +46,13 @@ export const ForceMuteSlashCmd = modActionsSlashCmd({
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
pluginData.state.common.sendErrorMessage(
interaction,
"Text or attachment required",
undefined,
undefined,
true
);
return;
}
@ -63,9 +66,10 @@ export const ForceMuteSlashCmd = modActionsSlashCmd({
if (options.mod) {
if (!canActAsOther) {
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
pluginData.state.common.sendErrorMessage(
interaction,
"You don't have permission to act as another moderator"
);
return;
}
@ -75,7 +79,7 @@ export const ForceMuteSlashCmd = modActionsSlashCmd({
const convertedTime = options.time ? convertDelayStringToMS(options.time) ?? undefined : undefined;
if (options.time && !convertedTime) {
pluginData.getPlugin(CommonPlugin).sendErrorMessage(interaction, `Could not convert ${options.time} to a delay`);
pluginData.state.common.sendErrorMessage(interaction, `Could not convert ${options.time} to a delay`);
return;
}
@ -83,7 +87,7 @@ export const ForceMuteSlashCmd = modActionsSlashCmd({
try {
contactMethods = readContactMethodsFromArgs(options) ?? undefined;
} catch (e) {
pluginData.getPlugin(CommonPlugin).sendErrorMessage(interaction, e.message);
pluginData.state.common.sendErrorMessage(interaction, e.message);
return;
}