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:
24
src/client.ts
Normal file
24
src/client.ts
Normal 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);
|
||||
});
|
||||
Reference in New Issue
Block a user