Initialize apps/bot and other cleanup
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { Client, Events, GatewayIntentBits } from 'discord.js';
|
||||
import { CommandService } from './services/cmd/service';
|
||||
|
||||
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
|
||||
|
||||
// SERVICES
|
||||
// -----------------------
|
||||
const s = (() => {
|
||||
const Commands = new CommandService(client);
|
||||
return { Commands };
|
||||
})();
|
||||
|
||||
client.once(Events.ClientReady, async (readyClient) => {
|
||||
// Initialize
|
||||
await s.Commands.init();
|
||||
|
||||
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
||||
});
|
||||
|
||||
client.on("guildMemberAdd", async (guildMember) => {
|
||||
});
|
||||
|
||||
client.on("messageCreate", async (message) => {
|
||||
if (message.author.bot) return;
|
||||
|
||||
const command = s.Commands.parse(message);
|
||||
if (command) command.execute(message);
|
||||
});
|
||||
|
||||
client.login(Bun.env.BOT_TOKEN);
|
||||
Reference in New Issue
Block a user