diff --git a/src/plugins/ModActions.ts b/src/plugins/ModActions.ts index 6addd326..8b43305d 100644 --- a/src/plugins/ModActions.ts +++ b/src/plugins/ModActions.ts @@ -305,11 +305,11 @@ export class ModActionsPlugin extends ZeppelinPlugin { /** * Update the specified case (or, if case number is omitted, your latest case) by adding more notes/details to it */ - @d.command("update", " ", { - overloads: [""], + @d.command("update", " [note:string$]", { + overloads: ["[note:string$]"], }) @d.permission("can_note") - async updateCmd(msg: Message, args: { caseNumber?: number; note: string }) { + async updateCmd(msg: Message, args: { caseNumber?: number; note?: string }) { let theCase: Case; if (args.caseNumber != null) { theCase = await this.cases.findByCaseNumber(args.caseNumber); @@ -322,18 +322,25 @@ export class ModActionsPlugin extends ZeppelinPlugin { return; } + if (!args.note && msg.attachments.length === 0) { + this.sendErrorMessage(msg.channel, "Text or attachment required"); + return; + } + + const note = this.formatReasonWithAttachments(args.note, msg.attachments); + const casesPlugin = this.getPlugin("cases"); await casesPlugin.createCaseNote({ caseId: theCase.id, modId: msg.author.id, - body: args.note, + body: note, }); this.serverLogs.log(LogType.CASE_UPDATE, { mod: msg.author, caseNumber: theCase.case_number, caseType: CaseTypes[theCase.type], - note: args.note, + note, }); msg.channel.createMessage(successMessage(`Case \`#${theCase.case_number}\` updated`));