first commit

This commit is contained in:
Marius Begby committed 2023-07-04 15:02:58 +02:00
commit 4eaea3a858
7 files changed
+1472

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
async function execute(interaction) {
const channel = interaction.member.voice.channel;
if (!channel) return interaction.reply('You are not connected to a voice channel!'); // make sure we have a voice channel
const query = interaction.options.getString('query', true); // we need input/query to play
// let's defer the interaction as things can take time to process
await interaction.deferReply();
try {
const { track } = await player.play(channel, query, {
nodeOptions: {
// nodeOptions are the options for guild node (aka your queue in simple word)
metadata: interaction // we can access this metadata object using queue.metadata later on
}
});
return interaction.followUp(`**${track.title}** enqueued!`);
} catch (e) {
// let's return error if something failed
return interaction.followUp(`Something went wrong: ${e}`);
}
}