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:
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
23
src/events/messageUpdate.ts
Normal file
23
src/events/messageUpdate.ts
Normal 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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user