mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 01:53:51 +02:00
New voice system
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { getVoiceConnection } = require('@discordjs/voice');
|
||||
|
||||
module.exports = class StopCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -15,13 +14,12 @@ module.exports = class StopCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const connection = getVoiceConnection(msg.guild.id);
|
||||
const connection = this.client.dispatchers.get(msg.guild.id);
|
||||
if (!connection) return msg.reply('I am not in a voice channel.');
|
||||
if (!this.client.dispatchers.has(msg.guild.id)) {
|
||||
return msg.reply(`I am not currently playing audio in this server.`);
|
||||
if (connection.canPlay) {
|
||||
return msg.reply('I am not currently playing audio in this server.');
|
||||
}
|
||||
this.client.dispatchers.get(msg.guild.id).stop();
|
||||
this.client.dispatchers.delete(msg.guild.id);
|
||||
connection.stop();
|
||||
return msg.reply('Stopped playing.');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user