* Resolve issue with copied v1 struct
* Speaking event patches, support Client Connect/Disconnect events
* Remove extra debug in heart.go
* Initial voice packet reading
* Resolve unallocated slices, use a static slice/array for decryption, split version/type
* Use separate slice for recvOpus, check return of secretbox.Open, and use constant for header size
* Update missing reference to packetHeaderSize
* Resolve decryption issues, add ReadPacket to session
* Update documentation for recvBuf/recvOpus
* Update comment for recvPacket's array
This commit refactors the Store interface in State into smaller
interfaces in package store. These interfaces are combined into one
structure called a "Cabinet". The default implementation of those
interfaces have been rewritten in package defaultstore, while the old
no-op implementation stays with the store package.
This commit also omitted several state handlers for user events, as it
is unclear what they are actually structured like.
This commit changes the gateway.Presence struct to be similar to commits
prior to the last refactor, that is, the struct would have the User and
GuildID fields. This is done so it's easier to store them.
This commit refactored several structures from package discord to be in
package gateway. Those structures are mostly presence ones, which per
official documentation has a lot more to do with the Gateway API than
the REST API or anything else.
This commit also renamed several global variables to have a more
consistent and obvious name.
As of v8, the user API has had a lot of minor and some major changes,
especially regarding its Ready event API. The most significant change is
the addition of the ReadySupplemental event as well as several changes
to the Ready field itself.
All of these changes above are breaking, and they have already broken
the state package. These breaking changes will be addressed in other
packages by the next commit.
* Rate: don't sleep if sleep exceeds context deadline
* Httputil: add Client.Timeout
* Bot: set default API timeout to 5 minutes
* Rate: reduce calls to time.Now in Acquire
* API: Optimize to use deadline instead of recalculating
Co-authored-by: diamondburned <datutbrus@gmail.com>
This comimt adds a method into the UDP connection to control the
internal frequency ticker which controls the speed of playback. For more
information, refer to (*voice/udp.Connection).ResetFrequency().
StopSpeaking is removed because it no longer works with variable
parameters. The functionality of that method was also arguably useless,
as it only sends silent frames.
This commit adds multiple thread safe guards to do better the
concurrency promises. However, it also omits completely those guarantees
in certain places that don't make sense to call concurrently. This is
mostly documented.
This commit also adds a small piece of code to concurrently run things
with the race detector.
This commit omits thread safe guarantees in the UDP voice connection.
This is done because the UDP connection should not be shared across
threads, so those guarantees are now omitted for performance.
Session will still guard a UDP connection around a read mutex, because
Session itself has thread safe guarantees. This may change in the
future.
This abstraction will mainly be in charge of handling events from a
channel and dispatching them to handlers in a thread safe manner. It
boxes synchronizing mechanisms inside a struct.
This commit adds subcommand aliases as well as additional code in
HelpGenerate to cover for both subcommand and command aliases.
A breaking change is that {,Must}RegisterSubcommandCustom methods are
now replaced with normal {,Must}RegisterSubcommand methods. This is
because they now use variadic strings, which could take 0, 1 or more
arguments.
This commit also allows AddMiddleware and similar methods to be given a
method directly:
sub.Plumb(cmds.PlumbedHandler)
sub.AddMiddleware(cmds.PlumbedHandler, cmds.plumbMiddleware)
This change closes issue #146.
remove boundary limits for DeleteMessages
rename deleteMessages to deleteMessagesRaw
use constant instead of limit literal
add min helper func
rename utils.go to math.go