mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +02:00
Sound Playing Check
This commit is contained in:
@@ -32,13 +32,22 @@ class SoundBoardCommand extends commando.Command {
|
|||||||
} else if(soundToPlay === 'list') {
|
} else if(soundToPlay === 'list') {
|
||||||
message.channel.send("**Available Sounds:** Cat, Pikachu, Vader, Doh, It's a Trap, Mario Death, Pokemon Center, Dun Dun Dun, Spongebob, Ugly Barnacle, Woo Hoo, Space, GLaDOS Bird, Airhorn, Zelda Chest");
|
message.channel.send("**Available Sounds:** Cat, Pikachu, Vader, Doh, It's a Trap, Mario Death, Pokemon Center, Dun Dun Dun, Spongebob, Ugly Barnacle, Woo Hoo, Space, GLaDOS Bird, Airhorn, Zelda Chest");
|
||||||
} else if(soundToPlay === sounds.avaliable[soundToPlay]) {
|
} else if(soundToPlay === sounds.avaliable[soundToPlay]) {
|
||||||
voiceChannel.join().then(connnection => {
|
let alreadyConnected = this.client.voiceConnections.get(voiceChannel.guild.id)
|
||||||
let stream = sounds.paths[soundToPlay];
|
if(alreadyConnected) {
|
||||||
let dispatcher = connnection.playStream(stream);
|
if(alreadyConnected.channel.id === voiceChannel.id) {
|
||||||
dispatcher.on('end', () => {
|
message.channel.send(':x: Error! I am already playing a sound!');
|
||||||
voiceChannel.leave();
|
} else {
|
||||||
});
|
message.channel.send(':x: Error! I am already playing a sound!');
|
||||||
});
|
}
|
||||||
|
} else {
|
||||||
|
voiceChannel.join().then(connnection => {
|
||||||
|
let stream = sounds.paths[soundToPlay];
|
||||||
|
let dispatcher = connnection.playStream(stream);
|
||||||
|
dispatcher.on('end', () => {
|
||||||
|
voiceChannel.leave();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
message.channel.send(':x: Error! Sound not found! Please use ;soundboard list to see a list of sounds you can play.');
|
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