generated from nhcarrigan/template
11b23b10a6
Merges modalInteractionCreate into interactionCreate, and replaces ActionRowBuilder with LabelBuilder for the announcement modal components.
65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
/**
|
|
* @copyright nhcarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
|
|
import { DiscordAnalytics } from "@nhcarrigan/discord-analytics";
|
|
import { Client, Events, GatewayIntentBits, Partials } from "discord.js";
|
|
import {
|
|
chatInputInteractionCreate,
|
|
modalSubmitInteractionCreate,
|
|
} from "./events/interactionCreate.js";
|
|
import { logger } from "./utils/logger.js";
|
|
|
|
/*
|
|
* Import {
|
|
* guildMessageCreate,
|
|
* directMessageCreate,
|
|
* } from "./events/messageCreate.js";
|
|
*/
|
|
|
|
const hikari = new Client({
|
|
intents: [
|
|
GatewayIntentBits.Guilds,
|
|
GatewayIntentBits.GuildMessages,
|
|
GatewayIntentBits.MessageContent,
|
|
GatewayIntentBits.DirectMessages,
|
|
],
|
|
partials: [
|
|
Partials.Channel,
|
|
],
|
|
});
|
|
|
|
const analytics = new DiscordAnalytics(hikari, logger);
|
|
|
|
hikari.once(Events.ClientReady, () => {
|
|
void logger.log(
|
|
"debug",
|
|
`Logged in as ${hikari.user?.username ?? "unknown"}`,
|
|
);
|
|
analytics.startCron();
|
|
});
|
|
|
|
/*
|
|
* Hikari.on(Events.MessageCreate, (message) => {
|
|
* if (!message.inGuild()) {
|
|
* void directMessageCreate(hikari, message);
|
|
* return;
|
|
* }
|
|
* void guildMessageCreate(hikari, message);
|
|
* });
|
|
*/
|
|
|
|
hikari.on(Events.InteractionCreate, (interaction) => {
|
|
if (interaction.isChatInputCommand()) {
|
|
void chatInputInteractionCreate(hikari, interaction);
|
|
return;
|
|
}
|
|
if (interaction.isModalSubmit()) {
|
|
void modalSubmitInteractionCreate(hikari, interaction);
|
|
}
|
|
});
|
|
|
|
await hikari.login(process.env.DISCORD_TOKEN);
|