import { ActionRowBuilder, ButtonBuilder, ButtonStyle, type ChatInputCommandInteraction, type Client, type ModalSubmitInteraction, SlashCommandBuilder, } from "discord.js"; import { db, guild as guildTable, manager as managerTable } from "@/database"; import { loggers } from "@/utils/logging"; const logger = loggers.interactions.child({ name: "messageCommand" }); const MODAL_ID = "message:report_message"; const INPUT_ID = "message_content"; const commandData = new SlashCommandBuilder() .setName("ticket-message") .setDescription("Send the ticket message in the designated channel") .addChannelOption((c) => c .setName("channel") .setDescription("The channel to send the ticket message in") .setRequired(true), ); async function execute( _client: Client, interaction: ChatInputCommandInteraction, ) { if (!interaction.guild || !interaction.member) { await interaction.reply({ content: "❌ this command can only be used in a server.", flags: ["Ephemeral"], }); return; } const channel = interaction.options.getChannel("channel"); if (!channel) { await interaction.reply({ content: "❌ Please provide a valid channel.", flags: ["Ephemeral"], }); return; } if (!("send" in channel)) { await interaction.reply({ content: "❌ This channel does not support sending messages.", flags: ["Ephemeral"], }); return; } const buttonRow = new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId("ticket:create") .setLabel("Confirm") .setStyle(ButtonStyle.Success), ); await channel.send({ content: `Ticket message from ${interaction.user.tag}:`, components: [buttonRow], }); await interaction.reply({ content: "✅ Ticket message sent.", flags: ["Ephemeral"], }); } export default { data: commandData, execute, };