mirror of
https://github.com/jaronpate/unicord.git
synced 2026-10-18 21:47:40 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user