diff --git a/db/populateDefaults.ts b/db/populateDefaults.ts index 055a70d..b93fe0a 100644 --- a/db/populateDefaults.ts +++ b/db/populateDefaults.ts @@ -8,6 +8,11 @@ const actions = [ 'cmd-info', 'cmd-report', 'cmd-setup', + 'cmd-gameSel', + 'btn-gameSel', + 'btn-customAct', + 'btn-createEvt', + 'btn-createWLEvt', ]; for (const action of actions) { await dbClient.execute('INSERT INTO command_cnt(command) values(?)', [action]).catch((e) => { diff --git a/src/buttons/event-creation/step1-gameSelection.ts b/src/buttons/event-creation/step1-gameSelection.ts index 980f775..1e1a6aa 100644 --- a/src/buttons/event-creation/step1-gameSelection.ts +++ b/src/buttons/event-creation/step1-gameSelection.ts @@ -20,6 +20,7 @@ import utils from '../../utils.ts'; import { customId as createCustomActivityBtnId } from './step1a-openCustomModal.ts'; import { customId as finalizeEventBtnId } from './step2-finalize.ts'; import { monthsShort } from './dateTimeUtils.ts'; +import { dbClient, queries } from '../../db.ts'; export const customId = 'gameSel'; export const eventTimeId = 'eventTime'; @@ -45,6 +46,14 @@ const customEventRow: ActionRow = { const execute = async (bot: Bot, interaction: Interaction) => { if (interaction.data && (interaction.data.name === slashCommandName || interaction.data.customId) && interaction.member && interaction.guildId && interaction.channelId) { + // Light Telemetry + if (interaction.data.name === slashCommandName) { + dbClient.execute(queries.callIncCnt('cmd-gameSel')).catch((e) => utils.commonLoggers.dbError('step1-gameSelection.ts@cmd', 'call sproc INC_CNT on', e)); + } + if (interaction.data.customId === customId) { + dbClient.execute(queries.callIncCnt('btn-gameSel')).catch((e) => utils.commonLoggers.dbError('step1-gameSelection.ts@btn', 'call sproc INC_CNT on', e)); + } + // Check if we are done const customIdIdxPath = (interaction.data.customId || '').substring((interaction.data.customId || '').indexOf(idSeparator) + 1) || ''; const valuesIdxPath = interaction.data?.values?.[0] || ''; diff --git a/src/buttons/event-creation/step1a-openCustomModal.ts b/src/buttons/event-creation/step1a-openCustomModal.ts index 5524c89..903d945 100644 --- a/src/buttons/event-creation/step1a-openCustomModal.ts +++ b/src/buttons/event-creation/step1a-openCustomModal.ts @@ -2,6 +2,7 @@ import { Bot, Interaction, InteractionResponseTypes, MessageComponentTypes, Text import { deleteTokenEarly, idSeparator, pathIdxSeparator } from './utils.ts'; import { customId as verifyCustomActivityId } from './step1b-verifyCustomActivity.ts'; import utils from '../../utils.ts'; +import { dbClient, queries } from '../../db.ts'; export const customId = 'customAct'; @@ -11,6 +12,9 @@ export const activityMaxPlayersId = 'activityMaxPlayers'; const execute = async (bot: Bot, interaction: Interaction) => { if (interaction.data?.customId && interaction.member && interaction.guildId && interaction.channelId) { + // Light Telemetry + dbClient.execute(queries.callIncCnt('btn-customAct')).catch((e) => utils.commonLoggers.dbError('step1a-openCustomModal.ts', 'call sproc INC_CNT on', e)); + const [actTitle, actSubtitle, activityMaxPlayers] = (interaction.data.customId.split(idSeparator)[1] || '').split(pathIdxSeparator); await deleteTokenEarly(bot, interaction, interaction.guildId, interaction.channelId, interaction.member.id); diff --git a/src/buttons/event-creation/step3-createEvent.ts b/src/buttons/event-creation/step3-createEvent.ts index 3854170..3214156 100644 --- a/src/buttons/event-creation/step3-createEvent.ts +++ b/src/buttons/event-creation/step3-createEvent.ts @@ -10,6 +10,11 @@ const execute = async (bot: Bot, interaction: Interaction) => { if ( interaction.data?.customId && interaction.member && interaction.guildId && interaction.channelId && interaction.message && interaction.message.embeds[0] && interaction.message.embeds[0].fields ) { + // Light Telemetry + dbClient.execute(queries.callIncCnt(interaction.data.customId.includes(idSeparator) ? 'btn-createWLEvt' : 'btn-createEvt')).catch((e) => + utils.commonLoggers.dbError('step3-createEvent.ts', 'call sproc INC_CNT on', e) + ); + deleteTokenEarly(bot, interaction, interaction.guildId, interaction.channelId, interaction.member.id); // Get OwnerId and EventTime from embed for DB