General structure works

This commit is contained in:
Bradley committed 2025-06-22 21:10:15 -04:00
1 parent de638f3e98
commit b307630642
7 files changed
+105 -5

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import { Client, Events, GatewayIntentBits, Guild, Interaction } from "discord.js"
import { utilities } from "./utilties"
import { commands } from "./commands"
import { config } from "./config"
const client : Client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.DirectMessages
]
})
client.once(Events.ClientReady, () => {
// TODO Winston should handle this
console.log("Breadbot is ready")
})
client.on(Events.GuildCreate, async (guild : Guild) => {
await utilities.command_utils.deployCommands(guild.id)
})
client.on(Events.InteractionCreate, async (interaction: Interaction) => {
if (!interaction.isCommand()) {
return
}
if (commands[interaction.commandName as keyof typeof commands]) {
commands[interaction.commandName as keyof typeof commands].execute(interaction)
}
})
client.login(config.DISCORD_TOKEN)