From a8cd84b8291990265dbdddcdaa079886234180a1 Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Wed, 15 Jul 2026 13:56:24 +0100 Subject: refactor codebase for dry --- 174bg/discord-bot/commands/requisition.js | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 174bg/discord-bot/commands/requisition.js (limited to '174bg/discord-bot/commands/requisition.js') diff --git a/174bg/discord-bot/commands/requisition.js b/174bg/discord-bot/commands/requisition.js new file mode 100644 index 0000000..be3cb8a --- /dev/null +++ b/174bg/discord-bot/commands/requisition.js @@ -0,0 +1,32 @@ +import { SlashCommandBuilder } from "discord.js"; +import createTicket from "../utilities/createTicket.js"; +import notifyRoleByName from "../utilities/notifyRoleByName.js"; + +export default { + data: new SlashCommandBuilder() + .setName("requisition") + .setDescription( + "Request items from the quartermaster. A new requisition ticket will be created.", + ) + .addStringOption((option) => + option + .setName("contents") + .setDescription("What are you requesting? Be as specific as possible.") + .setRequired(true), + ), + execute: async (interaction) => { + const contents = interaction.options.getString("contents"); + + const ticket = await createTicket(interaction, ["quartermaster"]); + + await ticket.send({ + content: `**New requisition request from <@${interaction.user.id}>**: ${contents}`, + }); + + // reply to the user + await interaction.reply({ + content: `Your requisition ticket has been created: <#${ticket.id}>`, + ephemeral: true, + }); + }, +}; -- cgit v1.2.3