generated from nhcarrigan/template
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { DiscordAnalytics } from "@nhcarrigan/discord-analytics";
|
||||
import {
|
||||
ActionRowBuilder,
|
||||
Client,
|
||||
@@ -24,10 +25,13 @@ const callista = new Client({
|
||||
intents: [],
|
||||
});
|
||||
|
||||
const analytics = new DiscordAnalytics(callista, logger);
|
||||
|
||||
// eslint-disable-next-line max-statements, complexity, max-lines-per-function -- Reason: It's fine like this
|
||||
const handleInteraction = async(
|
||||
interaction: BaseInteraction,
|
||||
): Promise<void> => {
|
||||
await analytics.logGatewayEvent(Events.InteractionCreate, { ...interaction });
|
||||
if (interaction.isButton()) {
|
||||
if (!interaction.channel) {
|
||||
await callista.channels.fetch(interaction.channelId);
|
||||
@@ -83,6 +87,7 @@ const handleInteraction = async(
|
||||
|
||||
callista.once("ready", () => {
|
||||
void logger.log("debug", "Callista is online!");
|
||||
analytics.startCron();
|
||||
});
|
||||
|
||||
callista.on(Events.InteractionCreate, (interaction) => {
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
import { addNote } from "../buttons/addNote.js";
|
||||
import { discord } from "../buttons/discord.js";
|
||||
import { donate } from "../buttons/donate.js";
|
||||
import { logger } from "../utils/logger.js";
|
||||
|
||||
/**
|
||||
* Bookmarks the target message by sending the user a DM with the message link.
|
||||
@@ -50,4 +51,5 @@ export const bookmark = async(
|
||||
await interaction.editReply({
|
||||
content: "✅ I've sent you a DM with the message link!",
|
||||
});
|
||||
await logger.metric("bookmarks", 1, { user: user.id });
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { logger } from "../utils/logger.js";
|
||||
import type { MessageContextMenuCommandInteraction } from "discord.js";
|
||||
|
||||
/**
|
||||
@@ -20,4 +21,5 @@ export const deleteCmd = async(
|
||||
await interaction.editReply({
|
||||
content: "✅ I've deleted the target message!",
|
||||
});
|
||||
await logger.metric("bookmark", -1, { user: interaction.user.id });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user