From f35ceb4c0d1c57e3ac69d3336809a2da2554ba65 Mon Sep 17 00:00:00 2001 From: Miikka Virtanen Date: Fri, 10 Feb 2017 07:47:10 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c5efc74..bec76fe 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ Inspired by Reddit's modmail system. 2. Clone or download this repository 3. Create a Discord server to be used as the modmail inbox 4. Copy `config.example.json` to `config.json` and fill in the values -5. Run the bot with `node src/index.js` +5. Install dependencies: `npm install` +6. Run the bot: `node src/index.js` ## Commands From 9e301c3c031c57cb6b0e8b61aa6f1e7353be2f13 Mon Sep 17 00:00:00 2001 From: Miikka Virtanen Date: Fri, 10 Feb 2017 12:17:53 +0200 Subject: [PATCH 2/2] 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