1
1
mirror of https://github.com/Burn-E99/GroupUp.git synced 2026-01-06 19:37:54 -05:00

Properly initialize join/leave/alt btns

This commit is contained in:
Ean Milligan (Bastion)
2023-04-07 01:45:33 -04:00
parent d60668e86f
commit fa0ffe35e5
4 changed files with 40 additions and 3 deletions

View File

@ -1,8 +1,18 @@
import { Bot, Interaction } from '../../../deps.ts';
import { dbClient, queries } from '../../db.ts';
import { somethingWentWrong } from '../../commandUtils.ts';
import utils from '../../utils.ts';
export const customId = 'alternateEvent';
export const execute = async (bot: Bot, interaction: Interaction) => {};
export const execute = async (bot: Bot, interaction: Interaction) => {
if (interaction.data?.customId && interaction.member && interaction.message && interaction.message.embeds[0] && interaction.message.embeds[0].fields) {
// Light Telemetry
dbClient.execute(queries.callIncCnt('btn-altEvent')).catch((e) => utils.commonLoggers.dbError('alternateEvent.ts', 'call sproc INC_CNT on', e));
} else {
somethingWentWrong(bot, interaction, 'noDataFromAlternateEventButton');
}
};
export const alternateEventButton = {
customId,

View File

@ -1,8 +1,21 @@
import { Bot, Interaction } from '../../../deps.ts';
import { dbClient, queries } from '../../db.ts';
import { somethingWentWrong } from '../../commandUtils.ts';
import { idSeparator } from '../event-creation/utils.ts';
import utils from '../../utils.ts';
export const customId = 'joinEvent';
export const execute = async (bot: Bot, interaction: Interaction) => {};
export const execute = async (bot: Bot, interaction: Interaction) => {
if (interaction.data?.customId && interaction.member && interaction.message && interaction.message.embeds[0] && interaction.message.embeds[0].fields) {
// Light Telemetry
dbClient.execute(queries.callIncCnt(interaction.data.customId.includes(idSeparator) ? 'btn-joinWLEvent' : 'btn-joinEvent')).catch((e) =>
utils.commonLoggers.dbError('joinEvent.ts', 'call sproc INC_CNT on', e)
);
} else {
somethingWentWrong(bot, interaction, 'noDataFromJoinEventButton');
}
};
export const joinEventButton = {
customId,

View File

@ -1,8 +1,18 @@
import { Bot, Interaction } from '../../../deps.ts';
import { dbClient, queries } from '../../db.ts';
import { somethingWentWrong } from '../../commandUtils.ts';
import utils from '../../utils.ts';
export const customId = 'leaveEvent';
export const execute = async (bot: Bot, interaction: Interaction) => {};
export const execute = async (bot: Bot, interaction: Interaction) => {
if (interaction.data?.customId && interaction.member && interaction.message && interaction.message.embeds[0] && interaction.message.embeds[0].fields) {
// Light Telemetry
dbClient.execute(queries.callIncCnt('btn-leaveEvent')).catch((e) => utils.commonLoggers.dbError('leaveEvent.ts', 'call sproc INC_CNT on', e));
} else {
somethingWentWrong(bot, interaction, 'noDataFromLeaveEventButton');
}
};
export const leaveEventButton = {
customId,