generated from nhcarrigan/template
feat: analytics
This commit is contained in:
@@ -10,6 +10,5 @@
|
||||
*/
|
||||
export const entitledGuilds = [
|
||||
"443134315778539530",
|
||||
"1146133490933436476",
|
||||
"1341981919180750898"
|
||||
"1354624415861833870",
|
||||
];
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user