Switch to module

This commit is contained in:
Tarrgon
2026-06-03 07:53:58 -04:00
parent d37d1c67cd
commit 5e5840ffdf
7 changed files with 37 additions and 31 deletions
+6 -6
View File
@@ -37,12 +37,6 @@ const buttons: Handler[] = [];
const modals: Handler[] = [];
const menus: Handler[] = [];
loadHandlersFrom('commands', commands);
loadHandlersFrom('context-menus', contextMenus);
loadHandlersFrom('buttons', buttons);
loadHandlersFrom('modals', modals);
loadHandlersFrom('menus', menus);
// Due to their reliance on each other, these two events (interactionCreate, and ready) have to stay here.
// Alternatively, they can move to another single file. Or use static classes.
client.on('interactionCreate', async (interaction) => {
@@ -126,6 +120,12 @@ client.on('interactionCreate', async (interaction) => {
client.on('clientReady', async () => {
console.log(`Logged in as ${client.user!.tag}!`);
await loadHandlersFrom('commands', commands);
await loadHandlersFrom('context-menus', contextMenus);
await loadHandlersFrom('buttons', buttons);
await loadHandlersFrom('modals', modals);
await loadHandlersFrom('menus', menus);
await refreshCommands(client);
await initIfNecessary(client, commands);