1
0
mirror of https://github.com/Burn-E99/SweeperBot.git synced 2026-06-04 07:53:50 -04:00

Add pollreaction system to automatically add reactions to polls

This commit is contained in:
Ean Milligan (Bastion)
2022-09-03 03:46:51 -04:00
parent 39567accfa
commit b2b6af90ce
9 changed files with 90 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ import { guildCreate } from './guildCreate.ts';
import { guildDelete } from './guildDelete.ts';
import { debug } from './debug.ts';
import { messageCreate } from './messageCreate.ts';
import { messageUpdate } from './messageUpdate.ts';
export default {
ready,
@@ -10,4 +11,5 @@ export default {
guildDelete,
debug,
messageCreate,
messageUpdate,
};

View File

@@ -10,6 +10,7 @@ import {
Message,
} from '../../deps.ts';
import commands from '../commands/_index.ts';
import functions from '../functions/_index.ts';
import utils from '../utils.ts';
export const messageCreate = (bot: Bot, message: Message) => {
@@ -23,6 +24,10 @@ export const messageCreate = (bot: Bot, message: Message) => {
commands.handleMentions(bot, message);
}
if (config.pollChannels.includes(message.channelId)) {
functions.pollReactions(bot, message);
}
// return as we are done handling this command
return;
}

View File

@@ -0,0 +1,23 @@
import config from '../../config.ts';
import {
// Discordeno deps
Bot,
// Discordeno deps
Message,
} from '../../deps.ts';
import functions from '../functions/_index.ts';
export const messageUpdate = (bot: Bot, message: Message) => {
// Ignore all other bots
if (message.isFromBot) return;
// Ignore all messages that are not commands
if (message.content.indexOf(config.prefix) !== 0) {
if (config.pollChannels.includes(message.channelId)) {
functions.pollReactions(bot, message, true);
}
// return as we are done handling this command
return;
}
};