This commit introduces a slash commands and autocompletion router. It
abstracts the switch-cases that the user has to do in each
InteractionEvent handler away.
The router is largely inspired by go-chi's design. Refer to the tests
for examples.
* feat: add support for disabling signature verification
* feat: refactor solution to not break api
* feat: make InteractionServer.ServeHTTP use InteractionServer.httpHandler
This commit separates the undocumented fields of Ready to
ReadyEventExtras. Realistically, this is never an issue for bots, but it
might cripple non-bot users when Discord makes breaking changes to the
API.
This change allows Ready to still be unmarshaled even when the
undocumented fields cannot be unmarshaled. It also adds a new json.Raw
field that allows the whole Ready event to be unmarshaled differently.
This new ReadyEventExtras is also no longer marshaled as part of Ready.
Instead, none of its field will be present. Although this is a breaking
change, it solely concerns non-bot APIs, so it's acceptable.
This is a workaround for some cases where ReadyEvent cannot be delivered
successfully, e.g. in the case of an unmarshal failure.
We should handle BackgroundErrorEvents in the future that fatally exits
on any unmarshal errors.
* Add Tag and TagID for forum capabilities
* set correct json flags
* Fix up naming and minor fixes
Co-authored-by: diamondburned <diamond@arikawa-hi.me>
This commit adds Interaction webhook server support directly into the
library.
Bots can now support both receiving events through the Discord gateway
and the Interaction webhook handler within the same library.
This reverts commit 7e49429.
The initial goal of this addition is to be used for interaction
followups, but the interaction event already comes with the application
ID.
The addition was also not done properly, and no invalidation on event is
done.
This reverts commit 2aaa2002d8.
The initial goal of this addition is to be used for interaction
followups, but the interaction event already comes with the application
ID.
The addition was also not done properly, and no invalidation on event is
done.
This commit adds these methods into *state.State:
- (*State).CurrentApplication
- (*State).CurrentApplicationID
This should make interacting with API functions that require AppIDs much
more pleasant.