mirror of
https://github.com/Burn-E99/SweeperBot.git
synced 2026-06-04 07:53:50 -04:00
WIP on addreaction detection
This commit is contained in:
@@ -7,10 +7,9 @@ import {
|
||||
log,
|
||||
LT,
|
||||
// Discordeno deps
|
||||
Message,
|
||||
Message,getReactions,
|
||||
} from '../../deps.ts';
|
||||
import commands from '../commands/_index.ts';
|
||||
import { pollReactions } from '../functions/pollReactions.ts';
|
||||
import functions from '../functions/_index.ts';
|
||||
import utils from '../utils.ts';
|
||||
|
||||
@@ -78,6 +77,17 @@ export const messageCreate = async (bot: Bot, message: Message) => {
|
||||
commands.sendMessage(bot, message, args);
|
||||
}
|
||||
break;
|
||||
case 'test':
|
||||
const test = await bot.helpers.getMessage(413640605491658754n, 1016090989816987701n);
|
||||
console.log(test)
|
||||
if (test.reactions && test.reactions.length) {
|
||||
console.log(test.reactions[0])
|
||||
const what = `${test.reactions[0].emoji.name}${test.reactions[0].emoji.id ? `:${test.reactions[0].emoji.id}` : ''}`;
|
||||
console.log(what)
|
||||
await getReactions(bot, 413640605491658754n, 1016090989816987701n, what)
|
||||
}
|
||||
// bot.helpers
|
||||
break;
|
||||
default:
|
||||
// Non-standard commands
|
||||
console.log(`${command} WIP`);
|
||||
|
||||
@@ -4,9 +4,21 @@ import {
|
||||
Bot,
|
||||
} from '../../deps.ts';
|
||||
import { ReactionAdd } from '../types/eventTypes.ts';
|
||||
import utils from '../utils.ts';
|
||||
import functions from '../functions/_index.ts';
|
||||
|
||||
export const reactionAdd = (bot: Bot, payload: ReactionAdd) => {
|
||||
export const reactionAdd = async (bot: Bot, payload: ReactionAdd) => {
|
||||
if (config.pollChannels.includes(payload.channelId)) {
|
||||
console.log(payload);
|
||||
try {
|
||||
const message = await bot.helpers.getMessage(payload.channelId, payload.messageId);
|
||||
const onlyOneWordRX = /(only one)/g
|
||||
if (message.content.toLowerCase().includes('clan poll') && message.content.toLowerCase().match(onlyOneWordRX)?.length) {
|
||||
functions.onlyOneReaction(bot, message);
|
||||
|
||||
// bot.helpers.getReactions()
|
||||
}
|
||||
} catch (e) {
|
||||
utils.commonLoggers.messageGetError('reactionAdd.ts:14', `failed to get message ${payload.channelId}-${payload.messageId}`, e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { pollReactions } from './pollReactions.ts';
|
||||
import { onlyOneReaction } from './onlyOneReaction.ts';
|
||||
|
||||
export default {
|
||||
pollReactions,
|
||||
onlyOneReaction,
|
||||
};
|
||||
|
||||
6
src/functions/onlyOneReaction.ts
Normal file
6
src/functions/onlyOneReaction.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import {
|
||||
// Discordeno deps
|
||||
Bot,
|
||||
} from "../../deps.ts";
|
||||
|
||||
export const onlyOneReaction = (bot: Bot) => { };
|
||||
Reference in New Issue
Block a user