Add light telemetry (command counting)
This commit is contained in:
parent
5ccf65d89b
commit
0a4c622dfe
|
@ -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) => {
|
||||
|
|
|
@ -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] || '';
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue