3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-23 09:35:02 +00:00

refactor: require reason on warnings and notes

This commit is contained in:
Hiroyuki 2021-09-14 11:25:45 -04:00
parent e5493742f5
commit c9a2259668
No known key found for this signature in database
GPG key ID: 258488F5F6FE3CAE
2 changed files with 7 additions and 8 deletions

View file

@ -32,10 +32,9 @@ export const NoteCmd = modActionsCmd({
}
const userName = user.tag;
const config = pluginData.config.get();
const reason = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
if (!reason && config.require_reason.includes("note")) {
sendErrorMessage(pluginData, msg.channel, "You must include a reason in your note");
const content = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
if (!content) {
sendErrorMessage(pluginData, msg.channel, "You must include content for your note");
return;
}
@ -44,18 +43,18 @@ export const NoteCmd = modActionsCmd({
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);
},
});

View file

@ -64,7 +64,7 @@ export const WarnCmd = modActionsCmd({
const config = pluginData.config.get();
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
if (!reason && config.require_reason.includes("warn")) {
if (!reason) {
sendErrorMessage(pluginData, msg.channel, "You must include a reason in your warning");
return;
}