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

Added Discord attachment link reaction, fixed emoji configuration and moved util functions

This commit is contained in:
Lily Bergonzat 2024-02-16 11:51:58 +01:00
parent a4c4b17a14
commit 592d037148
173 changed files with 1540 additions and 1170 deletions

View file

@ -1,8 +1,9 @@
import { slashOptions } from "knub";
import { canActOn, hasPermission, sendErrorMessage } from "../../../../pluginUtils";
import { canActOn, hasPermission } from "../../../../pluginUtils";
import { convertDelayStringToMS, resolveMember } from "../../../../utils";
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
import { waitForButtonConfirm } from "../../../../utils/waitForInteraction";
import { CommonPlugin } from "../../../Common/CommonPlugin";
import { MutesPlugin } from "../../../Mutes/MutesPlugin";
import { actualUnmuteCmd } from "../../functions/actualCommands/actualUnmuteCmd";
import { isBanned } from "../../functions/isBanned";
@ -30,7 +31,9 @@ export const UnmuteSlashCmd = {
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
if ((!options.reason || options.reason.trim() === "") && attachments.length < 1) {
sendErrorMessage(pluginData, interaction, "Text or attachment required", undefined, undefined, true);
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(interaction, "Text or attachment required", undefined, undefined, true);
return;
}
@ -45,7 +48,7 @@ export const UnmuteSlashCmd = {
!hasMuteRole &&
!memberToUnmute?.isCommunicationDisabled()
) {
sendErrorMessage(pluginData, interaction, "Cannot unmute: member is not muted");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(interaction, "Cannot unmute: member is not muted");
return;
}
@ -53,11 +56,9 @@ export const UnmuteSlashCmd = {
const banned = await isBanned(pluginData, options.user.id);
const prefix = pluginData.fullConfig.prefix;
if (banned) {
sendErrorMessage(
pluginData,
interaction,
`User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.`,
);
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(interaction, `User is banned. Use \`${prefix}forceunmute\` to unmute them anyway.`);
return;
} else {
// Ask the mod if we should upgrade to a forceunmute as the user is not on the server
@ -68,7 +69,9 @@ export const UnmuteSlashCmd = {
);
if (!reply) {
sendErrorMessage(pluginData, interaction, "User not on server, unmute cancelled by moderator");
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(interaction, "User not on server, unmute cancelled by moderator");
return;
}
}
@ -76,7 +79,7 @@ export const UnmuteSlashCmd = {
// Make sure we're allowed to unmute this member
if (memberToUnmute && !canActOn(pluginData, interaction.member, memberToUnmute)) {
sendErrorMessage(pluginData, interaction, "Cannot unmute: insufficient permissions");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(interaction, "Cannot unmute: insufficient permissions");
return;
}
@ -89,7 +92,9 @@ export const UnmuteSlashCmd = {
if (options.mod) {
if (!canActAsOther) {
sendErrorMessage(pluginData, interaction, "You don't have permission to act as another moderator");
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(interaction, "You don't have permission to act as another moderator");
return;
}
@ -99,7 +104,7 @@ export const UnmuteSlashCmd = {
const convertedTime = options.time ? convertDelayStringToMS(options.time) : null;
if (options.time && !convertedTime) {
sendErrorMessage(pluginData, interaction, `Could not convert ${options.time} to a delay`);
pluginData.getPlugin(CommonPlugin).sendErrorMessage(interaction, `Could not convert ${options.time} to a delay`);
return;
}