3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-14 05:57:18 +00:00

Add canActOn check

This commit is contained in:
Dark 2020-12-16 15:58:19 +01:00
parent 93bc15a7de
commit 71a4216af8
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8

View file

@ -7,7 +7,7 @@ import {
simpleClosestStringMatch,
stripObjectToScalars,
} from "../../../utils";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { VoiceChannel } from "eris";
import { LogType } from "../../../data/LogType";
import { resolveChannel } from "knub/dist/helpers";
@ -23,6 +23,10 @@ export const VcdisconnectCmd = utilityCmd({
},
async run({ message: msg, args, pluginData }) {
if (!canActOn(pluginData, msg.member, args.member)) {
sendErrorMessage(pluginData, msg.channel, "Cannot move: insufficient permissions");
}
if (!args.member.voiceState || !args.member.voiceState.channelID) {
sendErrorMessage(pluginData, msg.channel, "Member is not in a voice channel");
return;