* Added ratelimiter
Handles the new ratelimit headers
- X-RateLimit-Remaining
- X-RateLimit-Reset
- X-RateLimit-Global
* Pad only reset time with a second
* Moved ratelimiter out of internal package
* Change for loop, move global ratelimit check inside sleep check
* Moved ratelimiter locking to getBucket
* Added global bucket
* Changed how bucket id's are done
Now each request function will need to specify the bucket id if the
endpoint contains minor variables
* Allow empty bucketID in request
* Remove some uneeded Endpoint* function calls
* Added test for global ratelimits
* Fixed a silly little mistake causing incorrect ratelimits
* Update test comments, Fixed treating a endpoint as 2 in ratelimiting
* Use date header from discord instead of relying on sys time sync
* Update all REST functions to use RequestWithBucketID
* Embed mutex into bucket
* Added webhook and reaction buckets
Also cleaned up identify sending so there's now a function that handles
it instead of duplicate code. Renamed handshake* structs to identify*
structs to make naming match up.
We now store teh sessionID of the gateway connection for later use. We
are now caching the gateway url and will use it until unable to connect
to that gateway. We're not longer smashing the VoiceConnections map
during reconnects which was causing Voice problems. Slight change to
log output format.
With the recent change to the OnEvent event now always executing
insted of only on error we don't want this printing out every
single event. A different way to handle unknown events will be
added in the wsapi.go code.
With the recent change to the OnEvent event now always executing
insted of only on error we don't want this printing out every
single event. A different way to handle unknown events will be
added in the wsapi.go code.
AddHandler now returns a func that can remove the handler.
The handlers map is now guarded by its own mutex.
Moved eventMap to events.go for readability.
Improved documentation.