V0.4.2 - Fix reaction system to not react to self

This commit is contained in:
Ean Milligan (Bastion) 2022-09-10 11:53:46 -04:00
parent b4e16f6c56
commit 08a2b375a3
2 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,6 @@
export const config = { export const config = {
'name': 'Sweeper Bot', // Name of the bot 'name': 'Sweeper Bot', // Name of the bot
'version': '0.4.1', // Version of the bot 'version': '0.4.2', // Version of the bot
'token': 'the_bot_token', // Discord API Token for this bot 'token': 'the_bot_token', // Discord API Token for this bot
'localtoken': 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token" 'localtoken': 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
'prefix': 's!', // Prefix for all commands 'prefix': 's!', // Prefix for all commands

View File

@ -2,12 +2,16 @@ import config from '../../config.ts';
import { import {
// Discordeno deps // Discordeno deps
Bot, Bot,
botId,
} from '../../deps.ts'; } from '../../deps.ts';
import { ReactionAdd } from '../types/eventTypes.ts'; import { ReactionAdd } from '../types/eventTypes.ts';
import utils from '../utils.ts'; import utils from '../utils.ts';
import functions from '../functions/_index.ts'; import functions from '../functions/_index.ts';
export const reactionAdd = async (bot: Bot, payload: ReactionAdd) => { export const reactionAdd = async (bot: Bot, payload: ReactionAdd) => {
// Ignore self
if (botId === payload.userId) return;
if (config.pollChannels.includes(payload.channelId)) { if (config.pollChannels.includes(payload.channelId)) {
try { try {
const message = await bot.helpers.getMessage(payload.channelId, payload.messageId); const message = await bot.helpers.getMessage(payload.channelId, payload.messageId);