generated from nhcarrigan/template
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @copyright NHCarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { Client, GatewayIntentBits, Events, Partials } from "discord.js";
|
||||
import { handleMessageCreate } from "./events/handleMessageCreate.js";
|
||||
import { respondToDm } from "./modules/respondToDm.js";
|
||||
import { instantiateServer } from "./server/serve.js";
|
||||
import { logger } from "./utils/logger.js";
|
||||
import type { Amari } from "./interfaces/amari.js";
|
||||
|
||||
const amari: Amari = {
|
||||
discord: new Client({ intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
],
|
||||
partials: [ Partials.Channel ] }),
|
||||
};
|
||||
|
||||
amari.discord.once(Events.ClientReady, () => {
|
||||
void logger.log("debug",
|
||||
`Authenticated to Discord as ${amari.discord.user?.username ?? "unknown"}`);
|
||||
});
|
||||
|
||||
amari.discord.on(Events.MessageCreate, (message) => {
|
||||
if (!message.inGuild()) {
|
||||
void respondToDm(amari, message);
|
||||
return;
|
||||
}
|
||||
void handleMessageCreate(amari, message);
|
||||
});
|
||||
|
||||
await amari.discord.login(process.env.BOT_TOKEN);
|
||||
instantiateServer();
|
||||
Reference in New Issue
Block a user