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

Made confirms ephemeral and fixed slash command duration options

This commit is contained in:
Lily Bergonzat 2024-02-24 03:41:43 +01:00
parent a49bb81ce1
commit 4d8b6b5cd7
6 changed files with 16 additions and 25 deletions

View file

@ -76,7 +76,7 @@ export const CommonPlugin = zeppelinGuildPlugin<CommonPluginType>()({
});
}
const replyMethod = context.replied ? "followUp" : "reply";
const replyMethod = context.replied ? "editReply" : "reply";
return context[replyMethod]({
content: formattedBody,
@ -127,7 +127,7 @@ export const CommonPlugin = zeppelinGuildPlugin<CommonPluginType>()({
});
}
const replyMethod = context.replied ? "followUp" : "reply";
const replyMethod = context.replied ? "editReply" : "reply";
return context[replyMethod]({
content: formattedBody,

View file

@ -71,7 +71,7 @@ export const ForceMuteSlashCmd = {
ppId = interaction.user.id;
}
const convertedTime = options.time ? convertDelayStringToMS(options.time) : null;
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`);
return;
@ -92,7 +92,7 @@ export const ForceMuteSlashCmd = {
attachments,
mod,
ppId,
options.time,
convertedTime,
options.reason,
contactMethods,
);

View file

@ -54,12 +54,12 @@ export const ForceUnmuteSlashCmd = {
ppId = interaction.user.id;
}
const convertedTime = options.time ? convertDelayStringToMS(options.time) : null;
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`);
return;
}
actualUnmuteCmd(pluginData, interaction, options.user, attachments, mod, ppId, options.time, options.reason);
actualUnmuteCmd(pluginData, interaction, options.user, attachments, mod, ppId, convertedTime, options.reason);
},
};

View file

@ -45,15 +45,6 @@ export const MuteSlashCmd = {
async run({ interaction, options, pluginData }) {
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);
return;
}
const memberToMute = await resolveMember(pluginData.client, pluginData.guild, options.user.id);
if (!memberToMute) {
@ -106,7 +97,7 @@ export const MuteSlashCmd = {
ppId = interaction.user.id;
}
const convertedTime = options.time ? convertDelayStringToMS(options.time) : null;
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`);
return;
@ -127,7 +118,7 @@ export const MuteSlashCmd = {
attachments,
mod,
ppId,
options.time,
convertedTime,
options.reason,
contactMethods,
);

View file

@ -102,12 +102,12 @@ export const UnmuteSlashCmd = {
ppId = interaction.user.id;
}
const convertedTime = options.time ? convertDelayStringToMS(options.time) : null;
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`);
return;
}
actualUnmuteCmd(pluginData, interaction, options.user, attachments, mod, ppId, options.time, options.reason);
actualUnmuteCmd(pluginData, interaction, options.user, attachments, mod, ppId, convertedTime, options.reason);
},
};