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:
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 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);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue