mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 06:28:53 +00:00
first commit
This commit is contained in:
commit
4eaea3a858
7 files changed
+1472
No files matched your search
@@ -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}`);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user