mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-10 02:45:22 +02:00
Voice Channel Joining/Leaving Fix
This commit is contained in:
@@ -26,22 +26,22 @@ class SoundBoardCommand extends commando.Command {
|
||||
if (!voiceChannel) {
|
||||
return message.channel.send(`:x: Error! Please be in a voice channel first!`);
|
||||
}
|
||||
voiceChannel.join().then(connnection => {
|
||||
let soundToPlay = message.content.toLowerCase().split(" ").slice(1).join(" ");
|
||||
if(soundToPlay === "") {
|
||||
message.channel.send(':x: Error! No sound set. Please use ;soundboard list to see a list of sounds you can play.');
|
||||
} else if(soundToPlay === 'list') {
|
||||
message.channel.send('**Avaliable Sounds:** Meow');
|
||||
} else if(soundToPlay === sounds.avaliable[soundToPlay]) {
|
||||
let soundToPlay = message.content.toLowerCase().split(" ").slice(1).join(" ");
|
||||
if(soundToPlay === "") {
|
||||
message.channel.send(':x: Error! No sound set. Please use ;soundboard list to see a list of sounds you can play.');
|
||||
} else if(soundToPlay === 'list') {
|
||||
message.channel.send('**Avaliable Sounds:** Meow');
|
||||
} else if(soundToPlay === sounds.avaliable[soundToPlay]) {
|
||||
voiceChannel.join().then(connnection => {
|
||||
let stream = sounds.paths[soundToPlay];
|
||||
let dispatcher = connnection.playStream(stream);
|
||||
dispatcher.on('end', () => {
|
||||
voiceChannel.leave();
|
||||
});
|
||||
} else {
|
||||
message.channel.send(':x: Error! Sound not found! Please use ;soundboard list to see a list of sounds you can play.');
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
message.channel.send(':x: Error! Sound not found! Please use ;soundboard list to see a list of sounds you can play.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user