mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 17:45:03 +00:00
refactor: require reason on warnings and notes
This commit is contained in:
parent
e5493742f5
commit
c9a2259668
2 changed files with 7 additions and 8 deletions
|
@ -32,10 +32,9 @@ export const NoteCmd = modActionsCmd({
|
||||||
}
|
}
|
||||||
|
|
||||||
const userName = user.tag;
|
const userName = user.tag;
|
||||||
const config = pluginData.config.get();
|
const content = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
|
||||||
const reason = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
|
if (!content) {
|
||||||
if (!reason && config.require_reason.includes("note")) {
|
sendErrorMessage(pluginData, msg.channel, "You must include content for your note");
|
||||||
sendErrorMessage(pluginData, msg.channel, "You must include a reason in your note");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,18 +43,18 @@ export const NoteCmd = modActionsCmd({
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
modId: msg.author.id,
|
modId: msg.author.id,
|
||||||
type: CaseTypes.Note,
|
type: CaseTypes.Note,
|
||||||
reason,
|
reason: content,
|
||||||
});
|
});
|
||||||
|
|
||||||
pluginData.getPlugin(LogsPlugin).logMemberNote({
|
pluginData.getPlugin(LogsPlugin).logMemberNote({
|
||||||
mod: msg.author,
|
mod: msg.author,
|
||||||
user,
|
user,
|
||||||
caseNumber: createdCase.case_number,
|
caseNumber: createdCase.case_number,
|
||||||
reason,
|
reason: content,
|
||||||
});
|
});
|
||||||
|
|
||||||
sendSuccessMessage(pluginData, msg.channel, `Note added on **${userName}** (Case #${createdCase.case_number})`);
|
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);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,7 +64,7 @@ export const WarnCmd = modActionsCmd({
|
||||||
|
|
||||||
const config = pluginData.config.get();
|
const config = pluginData.config.get();
|
||||||
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
|
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");
|
sendErrorMessage(pluginData, msg.channel, "You must include a reason in your warning");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue