mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-13 15:58:06 +02:00
Add pause and resume
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
|
||||||
|
module.exports = class PauseCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'pause',
|
||||||
|
aliases: ['pause-voice-channel', 'pause-vc', 'pause-voice', 'pause-music', 'pause-playing'],
|
||||||
|
group: 'util-voice',
|
||||||
|
memberName: 'pause',
|
||||||
|
description: 'Pauses the current audio playing.',
|
||||||
|
guildOnly: true,
|
||||||
|
guarded: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(msg) {
|
||||||
|
const connection = this.client.voice.connections.get(msg.guild.id);
|
||||||
|
if (!connection) return msg.reply('I am not in a voice channel.');
|
||||||
|
if (!msg.channel.permissionsFor(msg.author).has('MOVE_MEMBERS') && connection.channel.members.size > 2) {
|
||||||
|
return msg.reply('You need the "Move members" permission to stop playing audio.');
|
||||||
|
}
|
||||||
|
if (!this.client.dispatchers.has(msg.guild.id)) {
|
||||||
|
return msg.reply(`I am not currently playing audio in this server.`);
|
||||||
|
}
|
||||||
|
this.client.dispatchers.get(msg.guild.id).pause();
|
||||||
|
return msg.reply('Paused playing.');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
|
||||||
|
module.exports = class ResumeCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'resume',
|
||||||
|
aliases: ['resume-voice-channel', 'resume-vc', 'resume-voice', 'resume-music', 'resume-playing'],
|
||||||
|
group: 'util-voice',
|
||||||
|
memberName: 'resume',
|
||||||
|
description: 'Resume the current audio playing.',
|
||||||
|
guildOnly: true,
|
||||||
|
guarded: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(msg) {
|
||||||
|
const connection = this.client.voice.connections.get(msg.guild.id);
|
||||||
|
if (!connection) return msg.reply('I am not in a voice channel.');
|
||||||
|
if (!msg.channel.permissionsFor(msg.author).has('MOVE_MEMBERS') && connection.channel.members.size > 2) {
|
||||||
|
return msg.reply('You need the "Move members" permission to stop playing audio.');
|
||||||
|
}
|
||||||
|
if (!this.client.dispatchers.has(msg.guild.id)) {
|
||||||
|
return msg.reply(`I am not currently playing audio in this server.`);
|
||||||
|
}
|
||||||
|
this.client.dispatchers.get(msg.guild.id).resume();
|
||||||
|
return msg.reply('Resumed playing.');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -4,7 +4,7 @@ module.exports = class StopCommand extends Command {
|
|||||||
constructor(client) {
|
constructor(client) {
|
||||||
super(client, {
|
super(client, {
|
||||||
name: 'stop',
|
name: 'stop',
|
||||||
aliases: ['stop-voice-channel', 'stop-vc', 'stop-voice', 'stop-play', 'stop-playing'],
|
aliases: ['stop-voice-channel', 'stop-vc', 'stop-voice', 'stop-music', 'stop-playing'],
|
||||||
group: 'util-voice',
|
group: 'util-voice',
|
||||||
memberName: 'stop',
|
memberName: 'stop',
|
||||||
description: 'Stops the current audio playing.',
|
description: 'Stops the current audio playing.',
|
||||||
|
|||||||
Reference in New Issue
Block a user