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] 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.`);