mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 22:05:01 +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
|
@ -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,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue