mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-08 08:05:03 +00:00
Used guildPluginSlashCommand instead of raw blueprints
This commit is contained in:
parent
7eff7bcaa6
commit
cbec6101e0
27 changed files with 168 additions and 121 deletions
|
@ -1,9 +1,12 @@
|
|||
import { GuildMember } from "discord.js";
|
||||
import { slashOptions } from "knub";
|
||||
import { CaseTypes } from "../../../../data/CaseTypes";
|
||||
import { hasPermission } from "../../../../pluginUtils";
|
||||
import { resolveMember } from "../../../../utils";
|
||||
import { generateAttachmentSlashOptions, retrieveMultipleOptions } from "../../../../utils/multipleSlashOptions";
|
||||
import { CommonPlugin } from "../../../Common/CommonPlugin";
|
||||
import { actualAddCaseCmd } from "../../functions/actualCommands/actualAddCaseCmd";
|
||||
import { modActionsSlashCmd } from "../../types";
|
||||
import { NUMBER_ATTACHMENTS_CASE_CREATION } from "../constants";
|
||||
|
||||
const opts = [
|
||||
|
@ -15,7 +18,7 @@ const opts = [
|
|||
}),
|
||||
];
|
||||
|
||||
export const AddCaseSlashCmd = {
|
||||
export const AddCaseSlashCmd = modActionsSlashCmd({
|
||||
name: "addcase",
|
||||
configPermission: "can_addcase",
|
||||
description: "Add an arbitrary case to the specified user without taking any action",
|
||||
|
@ -38,7 +41,7 @@ export const AddCaseSlashCmd = {
|
|||
const attachments = retrieveMultipleOptions(NUMBER_ATTACHMENTS_CASE_CREATION, options, "attachment");
|
||||
|
||||
// The moderator who did the action is the message author or, if used, the specified -mod
|
||||
let mod = interaction.member;
|
||||
let mod = interaction.member as GuildMember;
|
||||
const canActAsOther = await hasPermission(pluginData, "can_act_as_other", {
|
||||
channel: interaction.channel,
|
||||
member: interaction.member,
|
||||
|
@ -52,13 +55,13 @@ export const AddCaseSlashCmd = {
|
|||
return;
|
||||
}
|
||||
|
||||
mod = options.mod;
|
||||
mod = (await resolveMember(pluginData.client, pluginData.guild, options.mod.id))!;
|
||||
}
|
||||
|
||||
actualAddCaseCmd(
|
||||
pluginData,
|
||||
interaction,
|
||||
interaction.member,
|
||||
interaction.member as GuildMember,
|
||||
mod,
|
||||
attachments,
|
||||
options.user,
|
||||
|
@ -66,4 +69,4 @@ export const AddCaseSlashCmd = {
|
|||
options.reason || "",
|
||||
);
|
||||
},
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue