Properly initialize join/leave/alt btns
This commit is contained in:
parent
d60668e86f
commit
fa0ffe35e5
|
@ -13,6 +13,10 @@ const actions = [
|
|||
'btn-customAct',
|
||||
'btn-createEvt',
|
||||
'btn-createWLEvt',
|
||||
'btn-joinEvent',
|
||||
'btn-joinWLEvent',
|
||||
'btn-leaveEvent',
|
||||
'btn-altEvent',
|
||||
];
|
||||
for (const action of actions) {
|
||||
await dbClient.execute('INSERT INTO command_cnt(command) values(?)', [action]).catch((e) => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue