From ae3bf11d0b79457bf8bbc344e495a61d787ce82f Mon Sep 17 00:00:00 2001 From: Eegras Date: Thu, 30 Apr 2020 18:33:57 -0500 Subject: [PATCH 1/3] Update pm2 config file to run on Windows 10 https://github.com/Unitech/pm2/issues/3657#issuecomment-482010714 This is a known issue with pm2 on Windows. pm2 tries to run node.cmd as javascript which is wrong. --- modmailbot-pm2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modmailbot-pm2.json b/modmailbot-pm2.json index 6322645..4635ec8 100644 --- a/modmailbot-pm2.json +++ b/modmailbot-pm2.json @@ -3,6 +3,6 @@ "name": "ModMailBot", "cwd": "./", "script": "npm", - "args": "start" + "args": "./src/index.js" }] } From b566be85fef3b98aa0559dfd6dce6eaaa9d5fd7e Mon Sep 17 00:00:00 2001 From: "eegras@eegrasstudios.com" <1c2X$n%WFVkiL*ap#f*7biqj1HBNb1> Date: Fri, 5 Jun 2020 13:11:56 -0500 Subject: [PATCH 2/3] Implement reactOnSeen --- docs/configuration.md | 9 +++++++++ src/config.js | 3 +++ src/data/Thread.js | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index cb4f2bb..6918354 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -213,6 +213,15 @@ Make sure to do the necessary [port forwarding](https://portforward.com/) and ad **Default:** `!` Prefix for bot commands +#### reactOnSeen +**Default:** `off` +If enabled, the bot will react to messages sent to it with the emoji defined in `reactOnSeenEmoji` + +#### reactOnSeenEmoji +**Default:** `📨` +The emoji that the bot will react with when it sees a message. Requires `reactOnSeen` to be enabled. +Must be pasted in the config file as the Emoji representation and not as a unicode codepoint. + #### relaySmallAttachmentsAsAttachments **Default:** `off` If enabled, small attachments from users are sent as real attachments rather than links in modmail threads. diff --git a/src/config.js b/src/config.js index a2e3beb..769366e 100644 --- a/src/config.js +++ b/src/config.js @@ -121,6 +121,9 @@ const defaultConfig = { "knex": null, "logDir": path.join(__dirname, '..', 'logs'), + + "reactOnSeen": false, + "reactOnSeenEmoji": "\uD83D\uDCE8", }; // Load config values from environment variables diff --git a/src/data/Thread.js b/src/data/Thread.js index 23e9e4a..113eacb 100644 --- a/src/data/Thread.js +++ b/src/data/Thread.js @@ -163,6 +163,11 @@ class Thread { dm_message_id: msg.id }); + if (config.reactOnSeen) + { + await msg.addReaction(config.reactOnSeenEmoji) + } + if (this.scheduled_close_at) { await this.cancelScheduledClose(); await this.postSystemMessage(`<@!${this.scheduled_close_id}> Thread that was scheduled to be closed got a new reply. Cancelling.`); From 9994e075c1e02cc88100cad27d9e7fa60c2152b8 Mon Sep 17 00:00:00 2001 From: "eegras@eegrasstudios.com" <1c2X$n%WFVkiL*ap#f*7biqj1HBNb1> Date: Fri, 5 Jun 2020 13:14:14 -0500 Subject: [PATCH 3/3] Revert changes --- modmailbot-pm2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modmailbot-pm2.json b/modmailbot-pm2.json index 4635ec8..6322645 100644 --- a/modmailbot-pm2.json +++ b/modmailbot-pm2.json @@ -3,6 +3,6 @@ "name": "ModMailBot", "cwd": "./", "script": "npm", - "args": "./src/index.js" + "args": "start" }] }