feat: add analytics
Code Analysis / SonarQube (push) Failing after 15s
Node.js CI / Lint and Test (push) Successful in 40s

This commit is contained in:
2025-10-08 15:55:20 -07:00
parent a7f597fb56
commit 4b563abece
3 changed files with 61 additions and 6 deletions
+5
View File
@@ -3,6 +3,7 @@
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { DiscordAnalytics } from "@nhcarrigan/discord-analytics";
import { Client, Events, type ChatInputCommandInteraction } from "discord.js";
import { about } from "./modules/about.js";
import { alt } from "./modules/alt.js";
@@ -48,7 +49,10 @@ const client = new Client({
intents: [],
});
const analytics = new DiscordAnalytics(client, logger);
client.on(Events.InteractionCreate, (interaction) => {
void analytics.logGatewayEvent(Events.InteractionCreate, { ...interaction });
if (interaction.isChatInputCommand()) {
const handler = commands[interaction.commandName];
if (handler) {
@@ -67,6 +71,7 @@ client.on(Events.EntitlementDelete, (entitlement) => {
client.on(Events.ClientReady, () => {
void logger.log("debug", "Bot is ready.");
analytics.startCron();
});
instantiateServer();