feat: analytics
Node.js CI / Lint and Test (push) Successful in 49s

This commit is contained in:
2025-10-08 08:41:37 -07:00
parent 36ad30e4a2
commit 5cadb9bbee
12 changed files with 77 additions and 34 deletions
+5
View File
@@ -4,6 +4,7 @@
* @author Naomi Carrigan
*/
import { DiscordAnalytics } from "@nhcarrigan/discord-analytics";
import { Client,
GatewayIntentBits,
Events,
@@ -59,10 +60,13 @@ const amari: Amari = {
recentlyActiveChannels: new Set<string>(),
};
const analytics = new DiscordAnalytics(amari.discord, logger);
amari.discord.once(Events.ClientReady, () => {
void logger.log("debug",
`Authenticated to Discord as ${amari.discord.user?.username ?? "unknown"}`);
void cacheData(amari);
analytics.startCron();
scheduleJob("post news", "0 * * * *", async() => {
await postFreeCodeCampNews(amari);
await postHackerNews(amari);
@@ -91,6 +95,7 @@ amari.discord.on(Events.MessageCreate, (message) => {
});
amari.discord.on(Events.InteractionCreate, (interaction) => {
void analytics.logGatewayEvent(Events.InteractionCreate, { ...interaction });
if (interaction.isButton() && interaction.customId === "resolve") {
if (interaction.user.id !== ids.users.naomi) {
return void interaction.reply(