From 7a671eab1f0eabb746212d0da5e42ff9398b1b0b Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 16 Aug 2020 18:45:11 +0300 Subject: [PATCH] Ignore errors from adding a reaction with reactOnSeen --- src/data/Thread.js | 2 +- src/utils.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/data/Thread.js b/src/data/Thread.js index 4d91564..5f4263b 100644 --- a/src/data/Thread.js +++ b/src/data/Thread.js @@ -325,7 +325,7 @@ class Thread { } if (config.reactOnSeen) { - await msg.addReaction(config.reactOnSeenEmoji); + await msg.addReaction(config.reactOnSeenEmoji).catch(utils.noop); } // Interrupt scheduled closing, if in progress diff --git a/src/utils.js b/src/utils.js index 791ca67..8c993b2 100644 --- a/src/utils.js +++ b/src/utils.js @@ -310,13 +310,12 @@ function disableCodeBlocks(str) { return str.replace(/`/g, "`\u200b"); } -/** - * - */ function readMultilineConfigValue(str) { return Array.isArray(str) ? str.join("\n") : str; } +function noop() {} + module.exports = { BotError, @@ -355,4 +354,6 @@ module.exports = { disableCodeBlocks, readMultilineConfigValue, + + noop, };