feat: analytics
Code Analysis / SonarQube (push) Failing after 18s
Node.js CI / Lint and Test (push) Failing after 43s

This commit is contained in:
2025-10-09 20:25:35 -07:00
parent 453861702d
commit ba37114fee
9 changed files with 66 additions and 8 deletions
+1 -2
View File
@@ -10,6 +10,5 @@
*/
export const entitledGuilds = [
"443134315778539530",
"1146133490933436476",
"1341981919180750898"
"1354624415861833870",
];
+4
View File
@@ -12,6 +12,7 @@ import { role } from "./modules/role.js";
import { start } from "./modules/start.js";
import { instantiateServer } from "./server/serve.js";
import { logger } from "./utils/logger.js";
import { DiscordAnalytics } from "@nhcarrigan/discord-analytics";
process.on("unhandledRejection", (error) => {
if (error instanceof Error) {
@@ -33,6 +34,8 @@ const client = new Client({
intents: [ GatewayIntentBits.Guilds ],
});
const analytics = new DiscordAnalytics(client, logger);
const database = new PrismaClient();
// eslint-disable-next-line max-lines-per-function -- One too many...
@@ -98,6 +101,7 @@ client.on(Events.EntitlementDelete, (entitlement) => {
client.on(Events.ClientReady, () => {
void logger.log("debug", "Bot is ready.");
analytics.startCron();
});
instantiateServer();
+1
View File
@@ -69,6 +69,7 @@ export const about = async(
components: [ row ],
embeds: [ embed ],
});
await logger.metric("about_command", 1, {});
} catch (error) {
await replyToError(interaction);
if (error instanceof Error) {
+1
View File
@@ -106,6 +106,7 @@ Discord will auto-archive it, or if you are done discussing and want it out of t
}).catch(() => {
return null;
});
await logger.metric("close_command", 1, {});
} catch (error) {
await replyToError(interaction);
if (error instanceof Error) {
+1
View File
@@ -107,6 +107,7 @@ export const open = async(
await interaction.editReply({
content: `Ticket created~!`,
});
await logger.metric("open_command", 1, {});
} catch (error) {
await replyToError(interaction);
if (error instanceof Error) {
+1
View File
@@ -60,6 +60,7 @@ export const role = async(
await interaction.editReply({
content: `Your support role has been set to <@&${supportRole.id}>. This role will be pinged in new tickets.`,
});
await logger.metric("role_command", 1, {});
} catch (error) {
await replyToError(interaction);
if (error instanceof Error) {
+1
View File
@@ -109,6 +109,7 @@ export const start = async(
await interaction.editReply({
content: "Your ticket system is ready!",
});
await logger.metric("start_command", 1, {});
} catch (error) {
await replyToError(interaction);
if (error instanceof Error) {