mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Fix mafia
This commit is contained in:
@@ -41,16 +41,17 @@ module.exports = class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
playAudio(id) {
|
playAudio(id) {
|
||||||
this.dispatcher = this.connection.play(
|
const dispatcher = this.connection.play(
|
||||||
path.join(__dirname, '..', '..', 'assets', 'sounds', 'mafia', `${id}.mp3`), { volume: 2 }
|
path.join(__dirname, '..', '..', 'assets', 'sounds', 'mafia', `${id}.mp3`), { volume: 2 }
|
||||||
);
|
);
|
||||||
|
this.client.dispatchers.set(this.channel.guild.id, dispatcher);
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
this.dispatcher.once('finish', () => {
|
this.dispatcher.once('finish', () => {
|
||||||
this.dispatcher = null;
|
this.client.dispatchers.delete(this.channel.guild.id);
|
||||||
return res(true);
|
return res(true);
|
||||||
});
|
});
|
||||||
this.dispatcher.once('error', err => {
|
this.dispatcher.once('error', err => {
|
||||||
this.dispatcher = null;
|
this.client.dispatchers.delete(this.channel.guild.id);
|
||||||
return rej(err);
|
return rej(err);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user