NodeJS TypeScript Setup (#1)

* bot can login to discord

* changed node and npm to iron lts

* added typescript runnables

* more dev scripts

* readme update on scripts

* event handling skeleton

* fixed compiler target issue
This commit is contained in:
Kevin Dang
2023-12-22 11:22:16 -08:00
committed by GitHub
parent f4af329d44
commit c9dfd3671d
14 changed files with 1614 additions and 126 deletions

24
src/client.ts Normal file
View File

@@ -0,0 +1,24 @@
import { Client, GatewayIntentBits } from "discord.js";
import { registerEvents } from "./utils/events.js";
import Events from "./events/index.js";
// Import keys/tokens
import Keys from "./keys.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
registerEvents(client, Events)
// Try to log in the client
client.login(Keys.clientToken)
.catch((error) => {
console.error('[Login Error]', error);
process.exit(1);
});