Create Discord Music Bot

Can play and queue, can play music in multiple servers at once
This commit is contained in:
Myx
2023-06-21 04:24:58 +02:00
commit d9408907dd
13 changed files with 3177 additions and 0 deletions

24
commands/queue.js Normal file
View File

@@ -0,0 +1,24 @@
const musicQueue = require('../musicQueue');
const { getMusicStream } = require('../utils/getMusicStream');
async function queueCommand(interaction) {
await interaction.deferReply();
const query = interaction.options.getString('song');
const voiceChannel = interaction.member.voice.channel;
if (!voiceChannel) {
return interaction.followUp('You must be in a voice channel to use this command.');
}
const song = await getMusicStream(query);
if (!song) {
return interaction.followUp('Error finding song. Try Again.').then(msg => setTimeout(() => msg.delete(), 10000));
}
musicQueue.addToQueue(interaction.guild.id, song);
interaction.followUp(`Added ${song.title} to the queue.`);
}
module.exports.queueCommand = queueCommand;