Add stop functionality, fix duration

This commit is contained in:
Azaaxin
2023-06-25 11:08:14 +02:00
committed by Myx
parent dddbe81fab
commit c802be1a61
17 changed files with 304 additions and 226 deletions

View File

@@ -1,24 +1,27 @@
const musicQueue = require('../musicQueue');
const { getMusicStream } = require('../utils/getMusicStream');
const musicQueue = require("../musicQueue");
const { getMusicStream } = require("../utils/getMusicStream");
async function queueCommand(interaction) {
await interaction.deferReply();
await interaction.deferReply();
const query = interaction.options.getString('song');
const voiceChannel = interaction.member.voice.channel;
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.');
}
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));
}
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.`);
musicQueue.addToQueue(interaction.guild.id, song);
interaction.followUp(`Added ${song.title} to the queue.`);
}
module.exports.queueCommand = queueCommand;