mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-08 08:05:03 +00:00
Made mass action reason part of the slash command options
This commit is contained in:
parent
4d8b6b5cd7
commit
91025d8569
19 changed files with 213 additions and 88 deletions
|
@ -11,7 +11,7 @@ const opts = [
|
|||
slashOptions.user({ name: "mod", description: "The moderator to add this case as", required: false }),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the case",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ const opts = [
|
|||
}),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the ban",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const opts = [
|
|||
slashOptions.user({ name: "mod", description: "The moderator to ban as", required: false }),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the ban",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ const opts = [
|
|||
}),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the mute",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ const opts = [
|
|||
slashOptions.user({ name: "mod", description: "The moderator to unmute as", required: false }),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the unmute",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ const opts = [
|
|||
}),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the kick",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import { waitForReply } from "knub/helpers";
|
||||
import { commandTypeHelpers as ct } from "../../../../commandTypes";
|
||||
import { getContextChannel, sendContextResponse } from "../../../../pluginUtils";
|
||||
import { CommonPlugin } from "../../../Common/CommonPlugin";
|
||||
import { actualMassBanCmd } from "../../functions/actualCommands/actualMassBanCmd";
|
||||
import { modActionsMsgCmd } from "../../types";
|
||||
|
||||
|
@ -14,6 +17,17 @@ export const MassBanMsgCmd = modActionsMsgCmd({
|
|||
],
|
||||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
actualMassBanCmd(pluginData, msg, args.userIds, msg.member);
|
||||
// Ask for ban reason (cleaner this way instead of trying to cram it into the args)
|
||||
sendContextResponse(msg, "Ban reason? `cancel` to cancel");
|
||||
const banReasonReply = await waitForReply(pluginData.client, await getContextChannel(msg), msg.author.id);
|
||||
|
||||
if (!banReasonReply || !banReasonReply.content || banReasonReply.content.toLowerCase().trim() === "cancel") {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Cancelled");
|
||||
return;
|
||||
}
|
||||
|
||||
actualMassBanCmd(pluginData, msg, args.userIds, msg.member, banReasonReply.content, [
|
||||
...banReasonReply.attachments.values(),
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
import { slashOptions } from "knub";
|
||||
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
|
||||
import { CommonPlugin } from "../../../Common/CommonPlugin";
|
||||
import { actualMassBanCmd } from "../../functions/actualCommands/actualMassBanCmd";
|
||||
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
|
||||
|
||||
const opts = [
|
||||
slashOptions.string({ name: "reason", description: "The reason", required: false }),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
export const MassBanSlashCmd = {
|
||||
name: "massban",
|
||||
|
@ -7,9 +18,30 @@ export const MassBanSlashCmd = {
|
|||
description: "Mass-ban a list of user IDs",
|
||||
allowDms: false,
|
||||
|
||||
signature: [slashOptions.string({ name: "user-ids", description: "The list of user IDs to ban", required: true })],
|
||||
signature: [
|
||||
slashOptions.string({ name: "user-ids", description: "The list of user IDs to ban", required: true }),
|
||||
|
||||
...opts,
|
||||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
actualMassBanCmd(pluginData, interaction, options["user-ids"].split(/[\s,\r\n]+/), interaction.member);
|
||||
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;
|
||||
}
|
||||
|
||||
actualMassBanCmd(
|
||||
pluginData,
|
||||
interaction,
|
||||
options["user-ids"].split(/[\s,\r\n]+/),
|
||||
interaction.member,
|
||||
options.reason || "",
|
||||
attachments,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import { waitForReply } from "knub/helpers";
|
||||
import { commandTypeHelpers as ct } from "../../../../commandTypes";
|
||||
import { getContextChannel, sendContextResponse } from "../../../../pluginUtils";
|
||||
import { CommonPlugin } from "../../../Common/CommonPlugin";
|
||||
import { actualMassMuteCmd } from "../../functions/actualCommands/actualMassMuteCmd";
|
||||
import { modActionsMsgCmd } from "../../types";
|
||||
|
||||
|
@ -14,6 +17,20 @@ export const MassMuteMsgCmd = modActionsMsgCmd({
|
|||
],
|
||||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
actualMassMuteCmd(pluginData, msg, args.userIds, msg.member);
|
||||
// Ask for mute reason
|
||||
sendContextResponse(msg, "Mute reason? `cancel` to cancel");
|
||||
const muteReasonReceived = await waitForReply(pluginData.client, await getContextChannel(msg), msg.author.id);
|
||||
if (
|
||||
!muteReasonReceived ||
|
||||
!muteReasonReceived.content ||
|
||||
muteReasonReceived.content.toLowerCase().trim() === "cancel"
|
||||
) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Cancelled");
|
||||
return;
|
||||
}
|
||||
|
||||
actualMassMuteCmd(pluginData, msg, args.userIds, msg.member, muteReasonReceived.content, [
|
||||
...muteReasonReceived.attachments.values(),
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
import { slashOptions } from "knub";
|
||||
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
|
||||
import { CommonPlugin } from "../../../Common/CommonPlugin";
|
||||
import { actualMassMuteCmd } from "../../functions/actualCommands/actualMassMuteCmd";
|
||||
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
|
||||
|
||||
const opts = [
|
||||
slashOptions.string({ name: "reason", description: "The reason", required: false }),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
export const MassMuteSlashSlashCmd = {
|
||||
name: "massmute",
|
||||
|
@ -7,9 +18,30 @@ export const MassMuteSlashSlashCmd = {
|
|||
description: "Mass-mute a list of user IDs",
|
||||
allowDms: false,
|
||||
|
||||
signature: [slashOptions.string({ name: "user-ids", description: "The list of user IDs to mute", required: true })],
|
||||
signature: [
|
||||
slashOptions.string({ name: "user-ids", description: "The list of user IDs to mute", required: true }),
|
||||
|
||||
...opts,
|
||||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
actualMassMuteCmd(pluginData, interaction, options["user-ids"].split(/[\s,\r\n]+/), interaction.member);
|
||||
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;
|
||||
}
|
||||
|
||||
actualMassMuteCmd(
|
||||
pluginData,
|
||||
interaction,
|
||||
options["user-ids"].split(/[\s,\r\n]+/),
|
||||
interaction.member,
|
||||
options.reason || "",
|
||||
attachments,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import { waitForReply } from "knub/helpers";
|
||||
import { commandTypeHelpers as ct } from "../../../../commandTypes";
|
||||
import { actualMassBanCmd } from "../../functions/actualCommands/actualMassBanCmd";
|
||||
import { getContextChannel, sendContextResponse } from "../../../../pluginUtils";
|
||||
import { CommonPlugin } from "../../../Common/CommonPlugin";
|
||||
import { actualMassUnbanCmd } from "../../functions/actualCommands/actualMassUnbanCmd";
|
||||
import { modActionsMsgCmd } from "../../types";
|
||||
|
||||
export const MassUnbanMsgCmd = modActionsMsgCmd({
|
||||
|
@ -14,6 +17,16 @@ export const MassUnbanMsgCmd = modActionsMsgCmd({
|
|||
],
|
||||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
actualMassBanCmd(pluginData, msg, args.userIds, msg.member);
|
||||
// Ask for unban reason (cleaner this way instead of trying to cram it into the args)
|
||||
sendContextResponse(msg, "Unban reason? `cancel` to cancel");
|
||||
const unbanReasonReply = await waitForReply(pluginData.client, await getContextChannel(msg), msg.author.id);
|
||||
if (!unbanReasonReply || !unbanReasonReply.content || unbanReasonReply.content.toLowerCase().trim() === "cancel") {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Cancelled");
|
||||
return;
|
||||
}
|
||||
|
||||
actualMassUnbanCmd(pluginData, msg, args.userIds, msg.member, unbanReasonReply.content, [
|
||||
...unbanReasonReply.attachments.values(),
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
import { slashOptions } from "knub";
|
||||
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
|
||||
import { CommonPlugin } from "../../../Common/CommonPlugin";
|
||||
import { actualMassUnbanCmd } from "../../functions/actualCommands/actualMassUnbanCmd";
|
||||
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
|
||||
|
||||
const opts = [
|
||||
slashOptions.string({ name: "reason", description: "The reason", required: false }),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
export const MassUnbanSlashCmd = {
|
||||
name: "massunban",
|
||||
|
@ -7,9 +18,30 @@ export const MassUnbanSlashCmd = {
|
|||
description: "Mass-unban a list of user IDs",
|
||||
allowDms: false,
|
||||
|
||||
signature: [slashOptions.string({ name: "user-ids", description: "The list of user IDs to unban", required: true })],
|
||||
signature: [
|
||||
slashOptions.string({ name: "user-ids", description: "The list of user IDs to unban", required: true }),
|
||||
|
||||
...opts,
|
||||
],
|
||||
|
||||
async run({ interaction, options, pluginData }) {
|
||||
actualMassUnbanCmd(pluginData, interaction, options["user-ids"].split(/[\s,\r\n]+/), interaction.member);
|
||||
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;
|
||||
}
|
||||
|
||||
actualMassUnbanCmd(
|
||||
pluginData,
|
||||
interaction,
|
||||
options["user-ids"].split(/[\s,\r\n]+/),
|
||||
interaction.member,
|
||||
options.reason || "",
|
||||
attachments,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ const opts = [
|
|||
}),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the mute",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ const opts = [
|
|||
slashOptions.user({ name: "mod", description: "The moderator to unban as", required: false }),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the unban",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const opts = [
|
|||
slashOptions.user({ name: "mod", description: "The moderator to unmute as", required: false }),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the unmute",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ const opts = [
|
|||
}),
|
||||
...generateAttachmentSlashOptions(NUMBER_ATTACHMENTS_CASE_CREATION, {
|
||||
name: "attachment",
|
||||
description: "An attachment to add to the reason of the warn",
|
||||
description: "An attachment to add to the reason",
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue