refactor: decouple system events from command dispatch and add explicit system event handlers and improve gateway handling

This commit is contained in:
2026-05-17 22:27:25 -05:00
parent 8b1eecd823
commit ce45eacb3b
11 changed files with 313 additions and 84 deletions
+11 -2
View File
@@ -1,7 +1,7 @@
// Here we are defining what we want the interface to look like so that there is a goal to work towards
// Things here are not necessarily implemented in the actual code but show what we want it to look like to use the library
import { Expectation, Unicord, UnicordArgumentType } from '../rewrite/index.ts';
import { Expectation, Unicord, UnicordArgumentType, Intent } from '../rewrite/index.ts';
const DISCORD_APPLICATION_ID = process.env.APPLICATION_ID!;
const DISCORD_CLIENT_TOKEN = process.env.BOT_TOKEN!;
@@ -9,8 +9,17 @@ const DISCORD_CLIENT_TOKEN = process.env.BOT_TOKEN!;
// Create a new client instance
// Most usage will be via chaining methods off the client instance
const client = new Unicord({
intents: [
Intent.GUILDS,
Intent.GUILD_MESSAGES,
Intent.GUILD_MESSAGE_REACTIONS,
Intent.MESSAGE_CONTENT,
Intent.DIRECT_MESSAGES,
Intent.DIRECT_MESSAGE_REACTIONS,
],
application_id: DISCORD_APPLICATION_ID,
token: DISCORD_CLIENT_TOKEN,
prefix: '!!',
})
.registerChatCommand(
'ping',
@@ -98,6 +107,6 @@ const etc = new Unicord().registerChatCommand(
},
);
client.use(etc);
// client.use(etc);
client.login();