I'm having trouble trying to get a case statement to work, and since this is a specific question I can't find any search terms broad enough to get any kinds of good results.
I'm trying to get my discord bot to respond to a command "countdown" by playing a specific youtube video in a voice channel.
I've never done music or voice channel work in discord bots before, so I watched a tutorial, but it showed how to use a command like "play" followed by an argument that is a youtube video link. I want the command to not have any args and play a specific youtube video each time that 'countdown' command is used.
Here is what I have now, which requires an argument after the command is used.
case "countdown":
if (!message.member.voiceChannel) {
message.channel.sendMessage("You must be in a voice channel to initiate a countdown.");
return;
}
if (!servers[message.guild.id]) servers[message.guild.id] = {
queue: []
};
var server = servers[message.guild.id];
server.queue.push(args[1]);
if (!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection) {
play(connection, message);
})
break;
This is good for when I want the bot to play any music desired, but I just want one video associated with this command. Any help would be appreciated, thanks.