From fd83cf330032020f362f31c59b91f4bd69a5cb43 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 6 Apr 2024 16:17:00 -0400 Subject: [PATCH] Require MOVE_MEMBERS for voice commands --- commands/util-voice/leave.js | 3 +++ commands/util-voice/pause.js | 3 +++ commands/util-voice/resume.js | 3 +++ commands/util-voice/stop.js | 3 +++ 4 files changed, 12 insertions(+) diff --git a/commands/util-voice/leave.js b/commands/util-voice/leave.js index 8e9e9fa2..5b1a9f19 100644 --- a/commands/util-voice/leave.js +++ b/commands/util-voice/leave.js @@ -20,6 +20,9 @@ module.exports = class LeaveCommand extends Command { const usage = this.client.registry.commands.get('stop').usage(); return msg.reply(`I am currently playing audio in this server. Please use ${usage} first.`); } + if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) { + return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`); + } connection.leave(); return msg.reply(`Left **${connection.channel.name}**...`); } diff --git a/commands/util-voice/pause.js b/commands/util-voice/pause.js index 19fdf869..c972ee21 100644 --- a/commands/util-voice/pause.js +++ b/commands/util-voice/pause.js @@ -19,6 +19,9 @@ module.exports = class PauseCommand extends Command { if (connection.canPlay) { return msg.reply('I am not currently playing audio in this server.'); } + if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) { + return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`); + } connection.pause(); return msg.reply('Paused playing.'); } diff --git a/commands/util-voice/resume.js b/commands/util-voice/resume.js index 531196d0..a67abd46 100644 --- a/commands/util-voice/resume.js +++ b/commands/util-voice/resume.js @@ -19,6 +19,9 @@ module.exports = class ResumeCommand extends Command { if (connection.canPlay) { return msg.reply('I am not currently playing audio in this server.'); } + if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) { + return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`); + } connection.unpause(); return msg.reply('Resumed playing.'); } diff --git a/commands/util-voice/stop.js b/commands/util-voice/stop.js index 163ce07c..c01f50fa 100644 --- a/commands/util-voice/stop.js +++ b/commands/util-voice/stop.js @@ -19,6 +19,9 @@ module.exports = class StopCommand extends Command { if (connection.canPlay) { return msg.reply('I am not currently playing audio in this server.'); } + if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) { + return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`); + } connection.stop(); return msg.reply('Stopped playing.'); }