This commit adds an Unmarshal method into CommandInteractionOptions. It
is probably the first commit to break the rule of keeping package
discord simple.
The goal of this rationale is that package discord should continue
prioritizing convenience and ease of use by providing small, helpful
additions without being oversized.
This method, while it uses reflect, is actually fairly small in
implementation. Its functionality should be kept to a bare minimum and
as such will not cover every single use case (but should cover most).
This commit adds the StickerURLWithType methods into Sticker and
StickerItem types. No Lottie support is added yet, because I'm not sure
what the filename format for that is.
* implement the gateway side of guild scheduled event
* Add proper punctuation to each docstring
* Fix UserAdd and UserRemove events
* Add MANAGE_EVENTS permission
* Implement the API-side of scheduled events
* Add ScheduledEvent method
* Cleanup
* Support modal interactions along with the TextInput component
* Replace ModalInteraction with Modal to prevent confusion
* Fix the required field from not being used correctly
* PR Fixes
This commit refactors the whole package gateway as well as utils/ws
(formerly utils/wsutil) and voice/voicegateway. The new refactor
utilizes a design pattern involving a concurrent loop and an arriving
event channel.
An additional change was made to the way gateway events are typed.
Before, pretty much any type will satisfy a gateway event type, since
the actual type was just interface{}. The new refactor defines a
concrete interface that events can implement:
type Event interface {
Op() OpCode
EventType() EventType
}
Using this interface, the user can easily add custom gateway events
independently of the library without relying on string maps. This adds a
lot of type safety into the library and makes type-switching on Event
types much more reasonable.
Gateway error callbacks are also almost entirely removed in favor of
custom gateway events. A catch-all can easily be added like this:
s.AddHandler(func(err error) {
log.Println("gateway error:, err")
})