mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-25 10:25:01 +00:00
Merge be8fea1236
into 3cf08e5a49
This commit is contained in:
commit
f8b1aa646e
8 changed files with 39 additions and 4 deletions
|
@ -53,7 +53,13 @@ export const BanCmd = modActionsCmd({
|
|||
}
|
||||
const time = args["time"] ? args["time"] : null;
|
||||
|
||||
const config = pluginData.config.get();
|
||||
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
|
||||
if (!reason && config.require_reason.includes("ban")) {
|
||||
sendErrorMessage(pluginData, msg.channel, "You must include a reason in your ban");
|
||||
return;
|
||||
}
|
||||
|
||||
const memberToBan = await resolveMember(pluginData.client, pluginData.guild, user.id);
|
||||
// The moderator who did the action is the message author or, if used, the specified -mod
|
||||
let mod = msg.member;
|
||||
|
|
|
@ -32,25 +32,29 @@ export const NoteCmd = modActionsCmd({
|
|||
}
|
||||
|
||||
const userName = user.tag;
|
||||
const reason = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
|
||||
const content = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
|
||||
if (!content) {
|
||||
sendErrorMessage(pluginData, msg.channel, "You must include content for your note");
|
||||
return;
|
||||
}
|
||||
|
||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
const createdCase = await casesPlugin.createCase({
|
||||
userId: user.id,
|
||||
modId: msg.author.id,
|
||||
type: CaseTypes.Note,
|
||||
reason,
|
||||
reason: content,
|
||||
});
|
||||
|
||||
pluginData.getPlugin(LogsPlugin).logMemberNote({
|
||||
mod: msg.author,
|
||||
user,
|
||||
caseNumber: createdCase.case_number,
|
||||
reason,
|
||||
reason: content,
|
||||
});
|
||||
|
||||
sendSuccessMessage(pluginData, msg.channel, `Note added on **${userName}** (Case #${createdCase.case_number})`);
|
||||
|
||||
pluginData.state.events.emit("note", user.id, reason);
|
||||
pluginData.state.events.emit("note", user.id, content);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -49,7 +49,12 @@ export const UnbanCmd = modActionsCmd({
|
|||
}
|
||||
|
||||
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, user.id);
|
||||
const config = pluginData.config.get();
|
||||
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
|
||||
if (!reason && config.require_reason.includes("unban")) {
|
||||
sendErrorMessage(pluginData, msg.channel, "You must include a reason in your unban");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
|
||||
|
|
|
@ -64,6 +64,10 @@ export const WarnCmd = modActionsCmd({
|
|||
|
||||
const config = pluginData.config.get();
|
||||
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
|
||||
if (!reason) {
|
||||
sendErrorMessage(pluginData, msg.channel, "You must include a reason in your warning");
|
||||
return;
|
||||
}
|
||||
|
||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
const priorWarnAmount = await casesPlugin.getCaseTypeAmountForUserId(memberToWarn.id, CaseTypes.Warn);
|
||||
|
|
|
@ -67,7 +67,12 @@ export async function actualKickMemberCmd(
|
|||
return;
|
||||
}
|
||||
|
||||
const config = pluginData.config.get();
|
||||
const reason = formatReasonWithAttachments(args.reason, msg.attachments);
|
||||
if (!reason && config.require_reason.includes("kick")) {
|
||||
sendErrorMessage(pluginData, msg.channel, "You must include a reason in your kick");
|
||||
return;
|
||||
}
|
||||
|
||||
const kickResult = await kickMember(pluginData, memberToKick, reason, {
|
||||
contactMethods,
|
||||
|
|
|
@ -42,7 +42,12 @@ export async function actualMuteUserCmd(
|
|||
}
|
||||
|
||||
const timeUntilUnmute = args.time && humanizeDuration(args.time);
|
||||
const config = pluginData.config.get();
|
||||
const reason = args.reason ? formatReasonWithAttachments(args.reason, [...msg.attachments.values()]) : undefined;
|
||||
if (!reason && config.require_reason.includes("mute")) {
|
||||
sendErrorMessage(pluginData, msg.channel as TextChannel, "You must include a reason in your mute");
|
||||
return;
|
||||
}
|
||||
|
||||
let muteResult: MuteResult;
|
||||
const mutesPlugin = pluginData.getPlugin(MutesPlugin);
|
||||
|
|
|
@ -27,7 +27,12 @@ export async function actualUnmuteCmd(
|
|||
pp = msg.author;
|
||||
}
|
||||
|
||||
const config = pluginData.config.get();
|
||||
const reason = args.reason ? formatReasonWithAttachments(args.reason, [...msg.attachments.values()]) : undefined;
|
||||
if (!reason && config.require_reason.includes("unmute")) {
|
||||
sendErrorMessage(pluginData, msg.channel as TextChannel, "You must include a reason in your unmute");
|
||||
return;
|
||||
}
|
||||
|
||||
const mutesPlugin = pluginData.getPlugin(MutesPlugin);
|
||||
const result = await mutesPlugin.unmuteUser(user.id, args.time, {
|
||||
|
|
|
@ -46,6 +46,7 @@ export const ConfigSchema = t.type({
|
|||
can_deletecase: t.boolean,
|
||||
can_act_as_other: t.boolean,
|
||||
create_cases_for_manual_actions: t.boolean,
|
||||
require_reason: t.array(t.string),
|
||||
});
|
||||
export type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue