generated from nhcarrigan/template
feat: analytics
This commit is contained in:
+2
-1
@@ -25,7 +25,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/sdk": "0.36.3",
|
"@anthropic-ai/sdk": "0.36.3",
|
||||||
"@nhcarrigan/logger": "1.0.0",
|
"@nhcarrigan/discord-analytics": "0.0.6",
|
||||||
|
"@nhcarrigan/logger": "1.1.1",
|
||||||
"@prisma/client": "6.4.1",
|
"@prisma/client": "6.4.1",
|
||||||
"discord.js": "14.18.0",
|
"discord.js": "14.18.0",
|
||||||
"fastify": "5.2.1"
|
"fastify": "5.2.1"
|
||||||
|
|||||||
Generated
+54
-5
@@ -11,9 +11,12 @@ importers:
|
|||||||
'@anthropic-ai/sdk':
|
'@anthropic-ai/sdk':
|
||||||
specifier: 0.36.3
|
specifier: 0.36.3
|
||||||
version: 0.36.3
|
version: 0.36.3
|
||||||
|
'@nhcarrigan/discord-analytics':
|
||||||
|
specifier: 0.0.6
|
||||||
|
version: 0.0.6(@nhcarrigan/logger@1.1.1)(discord.js@14.18.0)
|
||||||
'@nhcarrigan/logger':
|
'@nhcarrigan/logger':
|
||||||
specifier: 1.0.0
|
specifier: 1.1.1
|
||||||
version: 1.0.0
|
version: 1.1.1
|
||||||
'@prisma/client':
|
'@prisma/client':
|
||||||
specifier: 6.4.1
|
specifier: 6.4.1
|
||||||
version: 6.4.1(prisma@6.4.1(typescript@5.7.3))(typescript@5.7.3)
|
version: 6.4.1(prisma@6.4.1(typescript@5.7.3))(typescript@5.7.3)
|
||||||
@@ -424,6 +427,12 @@ packages:
|
|||||||
'@jridgewell/trace-mapping@0.3.25':
|
'@jridgewell/trace-mapping@0.3.25':
|
||||||
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
||||||
|
|
||||||
|
'@nhcarrigan/discord-analytics@0.0.6':
|
||||||
|
resolution: {integrity: sha512-Mci/zSY2nE24BM2cZx5EiYqwpRTTCBznFfs2BphejzDAaWPt1P12V5ln7OSUbFLGhvTD/Qwi0za3yPv6shQLoA==}
|
||||||
|
peerDependencies:
|
||||||
|
'@nhcarrigan/logger': '>=1.1.0-hotfix'
|
||||||
|
discord.js: ^14.0.0
|
||||||
|
|
||||||
'@nhcarrigan/eslint-config@5.1.0':
|
'@nhcarrigan/eslint-config@5.1.0':
|
||||||
resolution: {integrity: sha512-TS6kwPTcm8pFzp34FRq+8PR+0jgVr7FDUDrfilAKtWDArqZSabTMtTt+N1rJyNHQqBHs7de/pUYNWiLpThy2Bw==}
|
resolution: {integrity: sha512-TS6kwPTcm8pFzp34FRq+8PR+0jgVr7FDUDrfilAKtWDArqZSabTMtTt+N1rJyNHQqBHs7de/pUYNWiLpThy2Bw==}
|
||||||
engines: {node: '>=22', pnpm: '>=9'}
|
engines: {node: '>=22', pnpm: '>=9'}
|
||||||
@@ -434,8 +443,8 @@ packages:
|
|||||||
typescript: '>=5'
|
typescript: '>=5'
|
||||||
vitest: '>=2'
|
vitest: '>=2'
|
||||||
|
|
||||||
'@nhcarrigan/logger@1.0.0':
|
'@nhcarrigan/logger@1.1.1':
|
||||||
resolution: {integrity: sha512-2e19Bie+ZKb6yKPKjhawqsENkhHatYkvBAmFZx9eToOXdOca+CYi51tldRMtejg6e0+4hOOf2bo5zdBQKmH0dw==}
|
resolution: {integrity: sha512-P6OEQFHDtf6psybYGljuCxkSW6DLQCsx1aZZ3w4YKBXHBFjDbhuvpM9K1kPhVN48hakitx2WPLEoIFr6YZELYw==}
|
||||||
|
|
||||||
'@nhcarrigan/typescript-config@4.0.0':
|
'@nhcarrigan/typescript-config@4.0.0':
|
||||||
resolution: {integrity: sha512-969HVha7A/Sg77fuMwOm6p14a+7C5iE6g55OD71srqwKIgksQl+Ex/hAI/pyzTQFDQ/FBJbpnHlR4Ov25QV/rw==}
|
resolution: {integrity: sha512-969HVha7A/Sg77fuMwOm6p14a+7C5iE6g55OD71srqwKIgksQl+Ex/hAI/pyzTQFDQ/FBJbpnHlR4Ov25QV/rw==}
|
||||||
@@ -997,6 +1006,10 @@ packages:
|
|||||||
core-js-compat@3.40.0:
|
core-js-compat@3.40.0:
|
||||||
resolution: {integrity: sha512-0XEDpr5y5mijvw8Lbc6E5AkjrHfp7eEoPlu36SWeAbcL8fn1G1ANe8DBlo2XoNN89oVpxWwOjYIPVzR4ZvsKCQ==}
|
resolution: {integrity: sha512-0XEDpr5y5mijvw8Lbc6E5AkjrHfp7eEoPlu36SWeAbcL8fn1G1ANe8DBlo2XoNN89oVpxWwOjYIPVzR4ZvsKCQ==}
|
||||||
|
|
||||||
|
cron-parser@4.9.0:
|
||||||
|
resolution: {integrity: sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==}
|
||||||
|
engines: {node: '>=12.0.0'}
|
||||||
|
|
||||||
cross-spawn@7.0.6:
|
cross-spawn@7.0.6:
|
||||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
@@ -1713,6 +1726,9 @@ packages:
|
|||||||
lodash@4.17.21:
|
lodash@4.17.21:
|
||||||
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
|
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
|
||||||
|
|
||||||
|
long-timeout@0.1.1:
|
||||||
|
resolution: {integrity: sha512-BFRuQUqc7x2NWxfJBCyUrN8iYUYznzL9JROmRz1gZ6KlOIgmoD+njPVbb+VNn2nGMKggMsK79iUNErillsrx7w==}
|
||||||
|
|
||||||
loose-envify@1.4.0:
|
loose-envify@1.4.0:
|
||||||
resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
|
resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@@ -1726,6 +1742,10 @@ packages:
|
|||||||
lru-cache@5.1.1:
|
lru-cache@5.1.1:
|
||||||
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
|
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
|
||||||
|
|
||||||
|
luxon@3.7.2:
|
||||||
|
resolution: {integrity: sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
magic-bytes.js@1.10.0:
|
magic-bytes.js@1.10.0:
|
||||||
resolution: {integrity: sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==}
|
resolution: {integrity: sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==}
|
||||||
|
|
||||||
@@ -1804,6 +1824,10 @@ packages:
|
|||||||
node-releases@2.0.19:
|
node-releases@2.0.19:
|
||||||
resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==}
|
resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==}
|
||||||
|
|
||||||
|
node-schedule@2.1.1:
|
||||||
|
resolution: {integrity: sha512-OXdegQq03OmXEjt2hZP33W2YPs/E5BcFQks46+G2gAxs4gHOIVD1u7EqlYLYSKsaIpyKCK9Gbk0ta1/gjRSMRQ==}
|
||||||
|
engines: {node: '>=6'}
|
||||||
|
|
||||||
normalize-package-data@2.5.0:
|
normalize-package-data@2.5.0:
|
||||||
resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==}
|
resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==}
|
||||||
|
|
||||||
@@ -2151,6 +2175,9 @@ packages:
|
|||||||
sonic-boom@4.2.0:
|
sonic-boom@4.2.0:
|
||||||
resolution: {integrity: sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==}
|
resolution: {integrity: sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==}
|
||||||
|
|
||||||
|
sorted-array-functions@1.3.0:
|
||||||
|
resolution: {integrity: sha512-2sqgzeFlid6N4Z2fUQ1cvFmTOLRi/sEDzSQ0OKYchqgoPmQBVyM3959qYx3fpS6Esef80KjmpgPeEr028dP3OA==}
|
||||||
|
|
||||||
source-map-js@1.2.1:
|
source-map-js@1.2.1:
|
||||||
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
@@ -2867,6 +2894,12 @@ snapshots:
|
|||||||
'@jridgewell/resolve-uri': 3.1.2
|
'@jridgewell/resolve-uri': 3.1.2
|
||||||
'@jridgewell/sourcemap-codec': 1.5.0
|
'@jridgewell/sourcemap-codec': 1.5.0
|
||||||
|
|
||||||
|
'@nhcarrigan/discord-analytics@0.0.6(@nhcarrigan/logger@1.1.1)(discord.js@14.18.0)':
|
||||||
|
dependencies:
|
||||||
|
'@nhcarrigan/logger': 1.1.1
|
||||||
|
discord.js: 14.18.0
|
||||||
|
node-schedule: 2.1.1
|
||||||
|
|
||||||
'@nhcarrigan/eslint-config@5.1.0(@typescript-eslint/utils@8.24.0(eslint@9.20.0)(typescript@5.7.3))(eslint@9.20.0)(playwright@1.50.1)(react@19.0.0)(typescript@5.7.3)(vitest@3.0.5(@types/node@22.13.1))':
|
'@nhcarrigan/eslint-config@5.1.0(@typescript-eslint/utils@8.24.0(eslint@9.20.0)(typescript@5.7.3))(eslint@9.20.0)(playwright@1.50.1)(react@19.0.0)(typescript@5.7.3)(vitest@3.0.5(@types/node@22.13.1))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-plugin-eslint-comments': 4.4.1(eslint@9.20.0)
|
'@eslint-community/eslint-plugin-eslint-comments': 4.4.1(eslint@9.20.0)
|
||||||
@@ -2896,7 +2929,7 @@ snapshots:
|
|||||||
- eslint-import-resolver-webpack
|
- eslint-import-resolver-webpack
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@nhcarrigan/logger@1.0.0': {}
|
'@nhcarrigan/logger@1.1.1': {}
|
||||||
|
|
||||||
'@nhcarrigan/typescript-config@4.0.0(typescript@5.7.3)':
|
'@nhcarrigan/typescript-config@4.0.0(typescript@5.7.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3497,6 +3530,10 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
browserslist: 4.24.4
|
browserslist: 4.24.4
|
||||||
|
|
||||||
|
cron-parser@4.9.0:
|
||||||
|
dependencies:
|
||||||
|
luxon: 3.7.2
|
||||||
|
|
||||||
cross-spawn@7.0.6:
|
cross-spawn@7.0.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
path-key: 3.1.1
|
path-key: 3.1.1
|
||||||
@@ -4427,6 +4464,8 @@ snapshots:
|
|||||||
|
|
||||||
lodash@4.17.21: {}
|
lodash@4.17.21: {}
|
||||||
|
|
||||||
|
long-timeout@0.1.1: {}
|
||||||
|
|
||||||
loose-envify@1.4.0:
|
loose-envify@1.4.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
js-tokens: 4.0.0
|
js-tokens: 4.0.0
|
||||||
@@ -4439,6 +4478,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
yallist: 3.1.1
|
yallist: 3.1.1
|
||||||
|
|
||||||
|
luxon@3.7.2: {}
|
||||||
|
|
||||||
magic-bytes.js@1.10.0: {}
|
magic-bytes.js@1.10.0: {}
|
||||||
|
|
||||||
magic-string@0.30.17:
|
magic-string@0.30.17:
|
||||||
@@ -4498,6 +4539,12 @@ snapshots:
|
|||||||
|
|
||||||
node-releases@2.0.19: {}
|
node-releases@2.0.19: {}
|
||||||
|
|
||||||
|
node-schedule@2.1.1:
|
||||||
|
dependencies:
|
||||||
|
cron-parser: 4.9.0
|
||||||
|
long-timeout: 0.1.1
|
||||||
|
sorted-array-functions: 1.3.0
|
||||||
|
|
||||||
normalize-package-data@2.5.0:
|
normalize-package-data@2.5.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
hosted-git-info: 2.8.9
|
hosted-git-info: 2.8.9
|
||||||
@@ -4888,6 +4935,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
atomic-sleep: 1.0.0
|
atomic-sleep: 1.0.0
|
||||||
|
|
||||||
|
sorted-array-functions@1.3.0: {}
|
||||||
|
|
||||||
source-map-js@1.2.1: {}
|
source-map-js@1.2.1: {}
|
||||||
|
|
||||||
spdx-correct@3.2.0:
|
spdx-correct@3.2.0:
|
||||||
|
|||||||
@@ -10,6 +10,5 @@
|
|||||||
*/
|
*/
|
||||||
export const entitledGuilds = [
|
export const entitledGuilds = [
|
||||||
"443134315778539530",
|
"443134315778539530",
|
||||||
"1146133490933436476",
|
"1354624415861833870",
|
||||||
"1341981919180750898"
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { role } from "./modules/role.js";
|
|||||||
import { start } from "./modules/start.js";
|
import { start } from "./modules/start.js";
|
||||||
import { instantiateServer } from "./server/serve.js";
|
import { instantiateServer } from "./server/serve.js";
|
||||||
import { logger } from "./utils/logger.js";
|
import { logger } from "./utils/logger.js";
|
||||||
|
import { DiscordAnalytics } from "@nhcarrigan/discord-analytics";
|
||||||
|
|
||||||
process.on("unhandledRejection", (error) => {
|
process.on("unhandledRejection", (error) => {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
@@ -33,6 +34,8 @@ const client = new Client({
|
|||||||
intents: [ GatewayIntentBits.Guilds ],
|
intents: [ GatewayIntentBits.Guilds ],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const analytics = new DiscordAnalytics(client, logger);
|
||||||
|
|
||||||
const database = new PrismaClient();
|
const database = new PrismaClient();
|
||||||
|
|
||||||
// eslint-disable-next-line max-lines-per-function -- One too many...
|
// eslint-disable-next-line max-lines-per-function -- One too many...
|
||||||
@@ -98,6 +101,7 @@ client.on(Events.EntitlementDelete, (entitlement) => {
|
|||||||
|
|
||||||
client.on(Events.ClientReady, () => {
|
client.on(Events.ClientReady, () => {
|
||||||
void logger.log("debug", "Bot is ready.");
|
void logger.log("debug", "Bot is ready.");
|
||||||
|
analytics.startCron();
|
||||||
});
|
});
|
||||||
|
|
||||||
instantiateServer();
|
instantiateServer();
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export const about = async(
|
|||||||
components: [ row ],
|
components: [ row ],
|
||||||
embeds: [ embed ],
|
embeds: [ embed ],
|
||||||
});
|
});
|
||||||
|
await logger.metric("about_command", 1, {});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await replyToError(interaction);
|
await replyToError(interaction);
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ Discord will auto-archive it, or if you are done discussing and want it out of t
|
|||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
await logger.metric("close_command", 1, {});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await replyToError(interaction);
|
await replyToError(interaction);
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ export const open = async(
|
|||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
content: `Ticket created~!`,
|
content: `Ticket created~!`,
|
||||||
});
|
});
|
||||||
|
await logger.metric("open_command", 1, {});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await replyToError(interaction);
|
await replyToError(interaction);
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ export const role = async(
|
|||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
content: `Your support role has been set to <@&${supportRole.id}>. This role will be pinged in new tickets.`,
|
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) {
|
} catch (error) {
|
||||||
await replyToError(interaction);
|
await replyToError(interaction);
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ export const start = async(
|
|||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
content: "Your ticket system is ready!",
|
content: "Your ticket system is ready!",
|
||||||
});
|
});
|
||||||
|
await logger.metric("start_command", 1, {});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await replyToError(interaction);
|
await replyToError(interaction);
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user