mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-08 08:05:03 +00:00
feat: first batch of emojis 🎉
This commit is contained in:
parent
dfb0e2c19d
commit
a4c4b17a14
91 changed files with 3659 additions and 2032 deletions
|
@ -0,0 +1,60 @@
|
|||
import { commandTypeHelpers as ct } from "../../../../commandTypes";
|
||||
import { canActOn, hasPermission, sendErrorMessage } from "../../../../pluginUtils";
|
||||
import { resolveMember, resolveUser } from "../../../../utils";
|
||||
import { actualForceBanCmd } from "../../functions/actualCommands/actualForceBanCmd";
|
||||
import { isBanned } from "../../functions/isBanned";
|
||||
import { modActionsMsgCmd } from "../../types";
|
||||
|
||||
const opts = {
|
||||
mod: ct.member({ option: true }),
|
||||
};
|
||||
|
||||
export const ForceBanMsgCmd = modActionsMsgCmd({
|
||||
trigger: "forceban",
|
||||
permission: "can_ban",
|
||||
description: "Force-ban the specified user, even if they aren't on the server",
|
||||
|
||||
signature: [
|
||||
{
|
||||
user: ct.string(),
|
||||
reason: ct.string({ required: false, catchAll: true }),
|
||||
|
||||
...opts,
|
||||
},
|
||||
],
|
||||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
const user = await resolveUser(pluginData.client, args.user);
|
||||
if (!user.id) {
|
||||
sendErrorMessage(pluginData, msg.channel, `User not found`);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the user exists as a guild member, make sure we can act on them first
|
||||
const member = await resolveMember(pluginData.client, pluginData.guild, user.id);
|
||||
if (member && !canActOn(pluginData, msg.member, member)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Cannot forceban this user: insufficient permissions");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the user isn't already banned
|
||||
const banned = await isBanned(pluginData, user.id);
|
||||
if (banned) {
|
||||
sendErrorMessage(pluginData, msg.channel, `User is already banned`);
|
||||
return;
|
||||
}
|
||||
|
||||
// The moderator who did the action is the message author or, if used, the specified -mod
|
||||
let mod = msg.member;
|
||||
if (args.mod) {
|
||||
if (!(await hasPermission(pluginData, "can_act_as_other", { message: msg }))) {
|
||||
sendErrorMessage(pluginData, msg.channel, "You don't have permission to use -mod");
|
||||
return;
|
||||
}
|
||||
|
||||
mod = args.mod;
|
||||
}
|
||||
|
||||
actualForceBanCmd(pluginData, msg.channel, msg.author.id, user, args.reason, [...msg.attachments.values()], mod);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue