mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
added default reasons object
This commit is contained in:
parent
ac3eb74500
commit
ed5214d4ec
6 changed files with 48 additions and 28 deletions
|
@ -62,7 +62,11 @@ const defaultOptions = {
|
||||||
kick_message: "You have been kicked from the {guildName} server. Reason given: {reason}",
|
kick_message: "You have been kicked from the {guildName} server. Reason given: {reason}",
|
||||||
ban_message: "You have been banned from the {guildName} server. Reason given: {reason}",
|
ban_message: "You have been banned from the {guildName} server. Reason given: {reason}",
|
||||||
tempban_message: "You have been banned from the {guildName} server for {banTime}. Reason given: {reason}",
|
tempban_message: "You have been banned from the {guildName} server for {banTime}. Reason given: {reason}",
|
||||||
default_ban_reason: "No reason specified",
|
default_reasons: {
|
||||||
|
mute: "No reason specified",
|
||||||
|
kick: "No reason specified",
|
||||||
|
ban: "No reason specified",
|
||||||
|
},
|
||||||
alert_on_rejoin: false,
|
alert_on_rejoin: false,
|
||||||
alert_channel: null,
|
alert_channel: null,
|
||||||
warn_notify_enabled: false,
|
warn_notify_enabled: false,
|
||||||
|
|
|
@ -61,7 +61,10 @@ export const ForcebanCmd = modActionsCmd({
|
||||||
mod = args.mod;
|
mod = args.mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
|
const config = pluginData.config.get();
|
||||||
|
const reason = args.reason
|
||||||
|
? formatReasonWithAttachments(args.reason, [...msg.attachments.values()])
|
||||||
|
: config.default_reasons?.ban || "No reason specified";
|
||||||
|
|
||||||
ignoreEvent(pluginData, IgnoredEventType.Ban, user.id);
|
ignoreEvent(pluginData, IgnoredEventType.Ban, user.id);
|
||||||
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, user.id);
|
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, user.id);
|
||||||
|
|
|
@ -67,7 +67,10 @@ export async function actualKickMemberCmd(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const reason = formatReasonWithAttachments(args.reason, msg.attachments);
|
const config = pluginData.config.get();
|
||||||
|
const reason = args.reason
|
||||||
|
? formatReasonWithAttachments(args.reason, msg.attachments)
|
||||||
|
: config.default_reasons?.kick || "No reason specified";
|
||||||
|
|
||||||
const kickResult = await kickMember(pluginData, memberToKick, reason, {
|
const kickResult = await kickMember(pluginData, memberToKick, reason, {
|
||||||
contactMethods,
|
contactMethods,
|
||||||
|
|
|
@ -42,7 +42,11 @@ export async function actualMuteUserCmd(
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeUntilUnmute = args.time && humanizeDuration(args.time);
|
const timeUntilUnmute = args.time && humanizeDuration(args.time);
|
||||||
const reason = args.reason ? formatReasonWithAttachments(args.reason, [...msg.attachments.values()]) : undefined;
|
|
||||||
|
const config = pluginData.config.get();
|
||||||
|
const reason = args.reason
|
||||||
|
? formatReasonWithAttachments(args.reason, [...msg.attachments.values()])
|
||||||
|
: config.default_reasons?.mute || "No reason specified";
|
||||||
|
|
||||||
let muteResult: MuteResult;
|
let muteResult: MuteResult;
|
||||||
const mutesPlugin = pluginData.getPlugin(MutesPlugin);
|
const mutesPlugin = pluginData.getPlugin(MutesPlugin);
|
||||||
|
|
|
@ -33,7 +33,6 @@ export async function banUserId(
|
||||||
banOptions: BanOptions = {},
|
banOptions: BanOptions = {},
|
||||||
banTime?: number,
|
banTime?: number,
|
||||||
): Promise<BanResult> {
|
): Promise<BanResult> {
|
||||||
const config = pluginData.config.get();
|
|
||||||
const user = await resolveUser(pluginData.client, userId);
|
const user = await resolveUser(pluginData.client, userId);
|
||||||
if (!user.id) {
|
if (!user.id) {
|
||||||
return {
|
return {
|
||||||
|
@ -42,7 +41,8 @@ export async function banUserId(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
reason = reason || (config.default_ban_reason || "No reason specified");
|
const config = pluginData.config.get();
|
||||||
|
reason ||= config.default_reasons?.ban || "No reason specified";
|
||||||
|
|
||||||
// Attempt to message the user *before* banning them, as doing it after may not be possible
|
// Attempt to message the user *before* banning them, as doing it after may not be possible
|
||||||
const member = await resolveMember(pluginData.client, pluginData.guild, userId);
|
const member = await resolveMember(pluginData.client, pluginData.guild, userId);
|
||||||
|
|
|
@ -23,7 +23,13 @@ export const ConfigSchema = t.type({
|
||||||
kick_message: tNullable(t.string),
|
kick_message: tNullable(t.string),
|
||||||
ban_message: tNullable(t.string),
|
ban_message: tNullable(t.string),
|
||||||
tempban_message: tNullable(t.string),
|
tempban_message: tNullable(t.string),
|
||||||
default_ban_reason: tNullable(t.string),
|
default_reasons: tNullable(
|
||||||
|
t.type({
|
||||||
|
mute: t.string,
|
||||||
|
kick: t.string,
|
||||||
|
ban: t.string,
|
||||||
|
}),
|
||||||
|
),
|
||||||
alert_on_rejoin: t.boolean,
|
alert_on_rejoin: t.boolean,
|
||||||
alert_channel: tNullable(t.string),
|
alert_channel: tNullable(t.string),
|
||||||
warn_notify_enabled: t.boolean,
|
warn_notify_enabled: t.boolean,
|
||||||
|
@ -92,36 +98,36 @@ export interface IIgnoredEvent {
|
||||||
|
|
||||||
export type WarnResult =
|
export type WarnResult =
|
||||||
| {
|
| {
|
||||||
status: "failed";
|
status: "failed";
|
||||||
error: string;
|
error: string;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
status: "success";
|
status: "success";
|
||||||
case: Case;
|
case: Case;
|
||||||
notifyResult: UserNotificationResult;
|
notifyResult: UserNotificationResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type KickResult =
|
export type KickResult =
|
||||||
| {
|
| {
|
||||||
status: "failed";
|
status: "failed";
|
||||||
error: string;
|
error: string;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
status: "success";
|
status: "success";
|
||||||
case: Case;
|
case: Case;
|
||||||
notifyResult: UserNotificationResult;
|
notifyResult: UserNotificationResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BanResult =
|
export type BanResult =
|
||||||
| {
|
| {
|
||||||
status: "failed";
|
status: "failed";
|
||||||
error: string;
|
error: string;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
status: "success";
|
status: "success";
|
||||||
case: Case;
|
case: Case;
|
||||||
notifyResult: UserNotificationResult;
|
notifyResult: UserNotificationResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WarnMemberNotifyRetryCallback = () => boolean | Promise<boolean>;
|
export type WarnMemberNotifyRetryCallback = () => boolean | Promise<boolean>;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue