From 9e301c3c031c57cb6b0e8b61aa6f1e7353be2f13 Mon Sep 17 00:00:00 2001 From: Miikka Virtanen Date: Fri, 10 Feb 2017 12:17:53 +0200 Subject: [PATCH] Fix "x previous logs" message not appearing in new modmail threads --- src/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 1c9a836..914b439 100644 --- a/src/index.js +++ b/src/index.js @@ -112,8 +112,11 @@ bot.on('messageCreate', (msg) => { // If the thread was just created, do some extra stuff if (thread._wasCreated) { // Mention previous logs at the start of the thread - if (logs.length > 0) { - bot.createMessage(thread.channelId, `${logs.length} previous modmail logs with this user. Use !logs ${msg.author.id} for details.`); + if (userLogs.length > 0) { + let logText; + if (userLogs.length === 1) logText = `There is 1 logged conversation with this user.`; + else logText = `There are ${userLogs.length} logged conversations with this user.`; + bot.createMessage(thread.channelId, `${logText} Type !logs for details.`); } // Ping mods of the new thread