mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
Improve permission level error in !ban
This commit is contained in:
parent
fec2b49129
commit
3def728ab5
1 changed files with 8 additions and 2 deletions
|
@ -8,7 +8,7 @@ import { formatReasonWithAttachments } from "../functions/formatReasonWithAttach
|
||||||
import { banUserId } from "../functions/banUserId";
|
import { banUserId } from "../functions/banUserId";
|
||||||
import { ignoreEvent } from "../functions/ignoreEvent";
|
import { ignoreEvent } from "../functions/ignoreEvent";
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
import { waitForReaction } from "knub/dist/helpers";
|
import { getMemberLevel, waitForReaction } from "knub/dist/helpers";
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
mod: ct.member({ option: true }),
|
mod: ct.member({ option: true }),
|
||||||
|
@ -63,7 +63,13 @@ export const BanCmd = modActionsCmd({
|
||||||
|
|
||||||
// Make sure we're allowed to ban this member if they are on the server
|
// Make sure we're allowed to ban this member if they are on the server
|
||||||
if (!forceban && !canActOn(pluginData, msg.member, memberToBan!)) {
|
if (!forceban && !canActOn(pluginData, msg.member, memberToBan!)) {
|
||||||
sendErrorMessage(pluginData, msg.channel, "Cannot ban: insufficient permissions");
|
const ourLevel = getMemberLevel(pluginData, msg.member);
|
||||||
|
const targetLevel = getMemberLevel(pluginData, memberToBan!);
|
||||||
|
sendErrorMessage(
|
||||||
|
pluginData,
|
||||||
|
msg.channel,
|
||||||
|
`Cannot ban: target permission level is equal or higher to yours, ${targetLevel} >= ${ourLevel}`,
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue