This resolves#547.
Adds a "LastPinTimestamp" field to the Channel structure, which reflects
the `last_pin_timestamp` field on the Discord API. This field is
indicative of whether or not the channel has any pinned messages, and
can save an API request from being sent if there are none.
FWIW, The API doesn't seem to return a 404 anymore when there are no
pinned messages; it returns a 200 with `[]`.
* Bump to v0.17.0
* Add members from GuildMembersChunk to state (#454)
* Revert "Add members from GuildMembersChunk to state (#454)" (#455)
This reverts commit e4487b30d4.
* added clarification when initializing discordgo
from the code I ran on my system with the latest changes this seems to be the syntax for the authentication tokens. I'm guessing it was just never updated.
Let me know if this is incorrect.
Thanks!
* travis: update go versions
* Add "Priority Speaker" permission constant
The permission "Priority Speaker" was missing as constant. Permission has been added as constant and to the "PermissionAllVoice" constant as well.
* Latency method
* fixed typo
* fixed linter error
* Renamed Latency to HeartbeatLatency
* HeartbeatLatency now returns time.Time
* return time.Duration instead, since .Sub() returns that
* Add full-stops to end of comments
* Added Mention() func for Channel
* Changed variable name
Adding the func in Github was so simple I didn't bother seeing if it'd compile, I shortly after realised my mistake.
* Added UserConnections function and structs
* Rename Connection to UserConnection
* Embed Integrations inside GuildIntegration and remove GuildIntegrationAccount
* Replaced GuildIntegration with Integration
* Added ability to change the online status
* Add structs for rick presence implementation
* Refractor and publicise UpdateStatusData
* Add UpdateStatusComplex for raw status data sending
* Case gameType to int, stopped it compiling
* Might want to gofmt.
Doesn't do it on save because Gogland removed it and their new thing I
can't make sense of.
* Revert "Added ability to change the online status"
This reverts commit 235cd15a8eebbec070cb95a5853295387bceae1c.
* Change gametypeto match
* Move RLock to UpdateStatusComplex
* Fix#406: reconnect() can be called while still connected
* Add memberMap to speed up member queries
* Fix error return value and remove deletion
* Fix GuildAdd member map initialization edge case
* Add rate limit buffering support
- Break request into requestInner
- Break LockBucket into LockBucketObject
- Change getBucket to GetBucket so it can be externally accessed
- Add RequestBuffer interface
- Add RequestBuffer pointer to Bucket struct
- Add RequestPostWithBuffer() function to Session
* Remove internal implementation, export ratelimiter instead
* Add heartbeat ACK response and error handling
- Error when sending a heartbeat now triggers a reconnection
- Op7 now triggers a reconnection
- Session now tracks the last heartbeat ACK that was recieved. If the
last ACK is more than FailedHeartbeatAcks*heartbeatinterval in the past,
this is treated as a dead connection and a reconnection is forced.
* Address @iopred comments
* 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.
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.