From a9e18d9750725446622eabfc472d36a52f5887c5 Mon Sep 17 00:00:00 2001 From: Jan <26145882+imverum@users.noreply.github.com> Date: Wed, 23 Dec 2020 14:08:41 +0100 Subject: [PATCH] add code --- util/karma.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/util/karma.js b/util/karma.js index f0d4616..8df10aa 100644 --- a/util/karma.js +++ b/util/karma.js @@ -1,4 +1,4 @@ -const client = require('../index').client; +const { client, logger } = require('../index'); const Enmap = require('enmap'); // Stores the karma and coins of users @@ -75,7 +75,11 @@ module.exports.run = () => { let noTimeout = (timeouts[user.id] && timeouts[user.id] < Date.now()); let perms = message.channel.permissionsFor(user.id); - if (!perms.has('SEND_MESSAGES') || !perms.has('ADD_REACTIONS')) return reaction.users.remove(user.id); + if (!perms.has('SEND_MESSAGES') || !perms.has('ADD_REACTIONS')) { + logger.warn(`${user.tag} => Ignoring reaction in ${message.channel}: User is missing permission`); + reaction.users.remove(user.id); + return; + } if (coins.get(user.id) < award.cost) { if (noTimeout) message.channel.send(`${user}, you don't have sufficient coins to use this award.`);