Refactor and update types and handlers

- README changes: removed 'as const' annotation and note.
- Connector changes: dispatched event for commands in gateway.
- Updated processor type guard for command handlers.
- Removed readonly from CommandHandler types in handler definitions.
- Test adjustments: updated demo tests to reliable command registration.
This commit is contained in:
2025-01-12 15:36:01 -06:00
parent 8943b5a06e
commit e6e4fd1a02
5 changed files with 18 additions and 18 deletions
+1 -3
View File
@@ -70,7 +70,7 @@ const avatarCommand = createCommandHandler({
description: 'The user to get the avatar for',
required: true
}
] as const,
],
execute: async (context: Context, args) => {
// Args will be typed here as { user: User }
context.reply(args.user.avatarURL);
@@ -85,8 +85,6 @@ client.applicationCommands.register('avatar', ApplicationCommandType.Chat, avata
// <...>
```
> NOTE: The `as const` is required to ensure the types are resolved correctly. This is to work around some TypeScript weirdness.
## Hydration
Hydration allows you to fetch and fill data on Discord objects. This is useful for when you need to fetch additional data about an object.