From e74363a55ccdfc2cf4f160b77ac8ccfc19eccb8a Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 19 Jul 2020 14:24:17 +0300 Subject: [PATCH] Show staff reply numbers in threads/logs --- src/data/Thread.js | 2 +- src/formatters.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/data/Thread.js b/src/data/Thread.js index 0304dcc..84582c3 100644 --- a/src/data/Thread.js +++ b/src/data/Thread.js @@ -197,7 +197,7 @@ class Thread { } // Save the log entry - const logContent = formatters.formatStaffReplyLogMessage(moderator, text, { isAnonymous, attachmentLinks }); + const logContent = formatters.formatStaffReplyLogMessage(moderator, text, threadMessage.message_number, { isAnonymous, attachmentLinks }); const threadMessage = await this._addThreadMessageToDB({ message_type: THREAD_MESSAGE_TYPE.TO_USER, user_id: moderator.id, diff --git a/src/formatters.js b/src/formatters.js index c3af718..8733019 100644 --- a/src/formatters.js +++ b/src/formatters.js @@ -31,6 +31,7 @@ const ThreadMessage = require('./data/ThreadMessage'); * @callback FormatStaffReplyLogMessage * @param {Eris.Member} moderator * @param {string} text + * @param {number} messageNumber * @param {{ * isAnonymous: boolean, * attachmentLinks: string[], @@ -128,7 +129,6 @@ const defaultFormatters = { ? `(Anonymous) (${modName}) ${mainRole ? mainRole.name : 'Moderator'}` : (mainRole ? `(${mainRole.name}) ${modName}` : modName); - // TODO: Add \`[${messageNumber}]\` here once !edit and !delete exist let result = `**${modInfo}:** ${text}`; if (config.threadTimestamps) { @@ -136,10 +136,12 @@ const defaultFormatters = { result = `[${formattedTimestamp}] ${result}`; } + result = `\`[${messageNumber}]\` ${result}`; + return result; }, - formatStaffReplyLogMessage(moderator, text, opts = {}) { + formatStaffReplyLogMessage(moderator, text, messageNumber, opts = {}) { const mainRole = utils.getMainRole(moderator); const modName = moderator.user.username; @@ -157,6 +159,8 @@ const defaultFormatters = { } } + result = `[${messageNumber}] ${result}`; + return result; },