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.
Renamed RateLimit struct to TooManyRequests{} and added new event struct
RateLimited{} which can be registerd to with AddHandler() and will be
emitted anytime a HTTP 429 is received on the HTTP API.
Corrected the Event struct to match it's new state based on Discord docs
and started tracking sequence number and sending it with heatbeats.
Also, move cleanup and comment improvements.
This adds a LogLevel setting for both Websocket and VoiceConnections
that can be configured to set the specific log level desired. This
also adds a new logging function that adds additional helpful
information when printing out log messages.
We're moving to lazy-loading guilds, meaning bots now recieve a READY
packet with guilds that only have 'id' and 'unavailable' fields. Post
READY, the client then lazyily recieves GUILD_CREATE's for the rest of
the guilds it's in. Previously we assumed the first instance of the
guild we got (from ready) had all the required information, now we need
to use the GUILD_CREATE if the guild was marked as unavailable.
With the upcoming API changes, Discord will be allowing bot users to be
onnected to more than one voice channel at a time. This commit is a
first stab at implementing that functionality in discordgo.
Voice works pretty good right now, ideally the next step is to cleanup
some of the channel-spam and weird blocking-spots.
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.