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

WIP: Note Slash Command

This commit is contained in:
Lily Bergonzat 2024-01-22 17:21:05 +01:00
parent 91339bb01e
commit dfb0e2c19d
29 changed files with 319 additions and 178 deletions

View file

@ -0,0 +1,31 @@
import { commandTypeHelpers as ct } from "../../../../commandTypes";
import { sendErrorMessage } from "../../../../pluginUtils";
import { resolveUser } from "../../../../utils";
import { actualNoteCmd } from "../../functions/actualNoteCmd";
import { modActionsMsgCmd } from "../../types";
export const NoteMsgCmd = modActionsMsgCmd({
trigger: "note",
permission: "can_note",
description: "Add a note to the specified user",
signature: {
user: ct.string(),
note: ct.string({ required: false, catchAll: true }),
},
async run({ pluginData, message: msg, args }) {
const user = await resolveUser(pluginData.client, args.user);
if (!user.id) {
sendErrorMessage(pluginData, msg.channel, `User not found`);
return;
}
if (!args.note && msg.attachments.size === 0) {
sendErrorMessage(pluginData, msg.channel, "Text or attachment required");
return;
}
actualNoteCmd(pluginData, msg.channel, msg.author, [...msg.attachments.values()], user, args.note || "");
},
});