diff --git a/commands/admin/selfRoles.js b/commands/admin/selfRoles.js deleted file mode 100644 index e2367f6..0000000 --- a/commands/admin/selfRoles.js +++ /dev/null @@ -1,9 +0,0 @@ -import { SlashCommandBuilder } from 'discord.js'; - -export const data = new SlashCommandBuilder() - .setName('self_roles') - .setDescription('Manages reactions for self roles.'); -export async function execute(interaction) { - await interaction - .reply('Unimplemented!'); -} diff --git a/commands/admin/self_roles.js b/commands/admin/self_roles.js new file mode 100644 index 0000000..4932bd7 --- /dev/null +++ b/commands/admin/self_roles.js @@ -0,0 +1,50 @@ +import { SlashCommandBuilder } from 'discord.js'; + +export const data = new SlashCommandBuilder() + .setName('self_roles') + .setDescription('Manages reactions for self roles.') + .addSubcommand(subcommand => + subcommand + .setName('create') + .setDescription('Creates new message in channel.') + .addStringOption(option => + option + .setRequired(true) + .setName('text') + .setDescription('The text to be displayed in the message.'))) + .addSubcommand(subcommand => + subcommand + .setName('add') + .setDescription('Adds functionality to an existing message.') + .addStringOption(option => + option + .setName('id') + .setRequired(true) + .setDescription('The ID to reference the message to be used.'))); +export async function execute(interaction) { + const channel = interaction.channel; + let message = null; + + switch (interaction.options.getSubcommand()) { + case 'create': + // Create message with text input + const text = interaction.options.getString('text'); + message = await channel.send(text); + // Reply and delete to acknowledge command + interaction.deferReply(); + interaction.deleteReply(); + break; + case 'add': + // Get message by id + const id = interaction.options.getString('id'); + message = await channel.messages.fetch(id); + // Reply to acknowledge command + await interaction.reply({ + content: 'Successfully fetched message!', + ephemeral: true, + }); + break; + } + + console.debug(`[DEBUG] Message ID: '${message.id}'.`); +}