mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-17 07:05:03 +00:00
Global unban for main server
This commit is contained in:
parent
e0b4f18403
commit
788eb98a50
3 changed files with 12 additions and 1 deletions
|
@ -56,6 +56,7 @@ import { BanOptions, ConfigSchema, KickOptions, ModActionsPluginType, WarnOption
|
|||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
main_guild: null,
|
||||
dm_on_warn: true,
|
||||
dm_on_kick: false,
|
||||
dm_on_ban: false,
|
||||
|
|
|
@ -47,12 +47,21 @@ export const UnbanCmd = modActionsCmd({
|
|||
mod = args.mod;
|
||||
}
|
||||
|
||||
const config = pluginData.config.get();
|
||||
const guild = pluginData.client.guilds.cache.get(config.main_guild as Snowflake);
|
||||
if (!guild) {
|
||||
return {
|
||||
status: "failed",
|
||||
error: "Guild not found!",
|
||||
};
|
||||
}
|
||||
|
||||
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, user.id);
|
||||
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
|
||||
|
||||
try {
|
||||
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
|
||||
await pluginData.guild.bans.remove(user.id as Snowflake, reason ?? undefined);
|
||||
await guild.bans.remove(user.id as Snowflake, reason ?? undefined);
|
||||
} catch {
|
||||
sendErrorMessage(pluginData, msg.channel, "Failed to unban member; are you sure they're banned?");
|
||||
return;
|
||||
|
|
|
@ -12,6 +12,7 @@ import { UserNotificationMethod, UserNotificationResult, tNullable } from "../..
|
|||
import { CaseArgs } from "../Cases/types";
|
||||
|
||||
export const ConfigSchema = t.type({
|
||||
main_guild: tNullable(t.string),
|
||||
dm_on_warn: t.boolean,
|
||||
dm_on_kick: t.boolean,
|
||||
dm_on_ban: t.boolean,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue