reference channel directly

This commit is contained in:
Baipyrus 2024-02-08 18:24:47 +01:00
parent 76641b31c7
commit 83068ae085

View File

@ -20,11 +20,11 @@ export const data = new SlashCommandBuilder()
subcommand subcommand
.setName('register') .setName('register')
.setDescription('Registers an existing voice channel.') .setDescription('Registers an existing voice channel.')
.addStringOption((option) => .addChannelOption((option) =>
option option
.setName('id')
.setRequired(true) .setRequired(true)
.setDescription('The ID to reference the voice channel to be used.') .setName('channel')
.setDescription('The voice channel to be used.')
) )
); );
export async function execute(interaction) { export async function execute(interaction) {
@ -59,11 +59,7 @@ export async function execute(interaction) {
} }
case 'register': { case 'register': {
// Get channel id from user input // Get channel id from user input
const id = options.getString('id'); const id = options.getChannel('channel');
step = 'fetch';
// Try fetching channel by id
await guild.channels.fetch(id);
// Save channel data // Save channel data
step = 'save'; step = 'save';