* Remove GroupDMChannels
they sparked no joy
* Start partials for message deletion
* MessageUpdate partials
* Add partials as an opt-in client option
* Add fetch() to Message
* Message.author should never be undefined
* Fix channels being the wrong type
* Allow fetching channels
* Refactor and add reaction add partials
* Reaction remove partials
* Check for emoji first
* fix message fetching
janky
* User partials in audit logs
* refactor overwrite code
* guild member partials
* partials as a whitelist
* document GuildMember#fetch
* fix: check whether a structure is a partial, not whether cache is true
* typings: Updated for latest commit (#3075)
* partials: fix messageUpdate behaviour (now "old" message can be partial)
* partials: add warnings and docs
* partials: add partials to index.yml
* partials: tighten "partial" definitions
* partials: fix embed-only messages counting as partials
* chore(deps): Updated all required, peer, and development dependencies
And engines.node to require 10
* chore(peerDeps): Updated uws to 11.149.1
Clarified my doubts with iCrawl
* fix: Sharding bugs, silent disconnects and cleanup code
* typings
* fix: Destroy connecting with close code different from 1000
Per `If a client does not receive a heartbeat ack between its attempts at sending heartbeats, it should immediately terminate the connection with a non-1000 close code, reconnect, and attempt to resume.`
* misc: Wait x ms before reconnecting
Per https://discordapp.com/developers/docs/topics/gateway#resuming
* docs
* nit: docs
* misc: Prevent multiple calls to WebSocketManager#destroy
* fix: Implement destroying if you reset the token
* misc: Clear the WS packet queue on WebSocketShard#destroy
You can't send those packets anywhere anymore, so no point in keeping them
* fix: Handle session limits when reconnecting a full shard, cleanup
* misc: No need to create a new shard instance
* fix: closeSequence being null, thus emitting null on Client#resumed
* misc: Remove GUILD_SYNC Gateway handler and add missing dot to string
* misc: Close WS with code 4000 if we didn't get a heartbeat in time
As said in the Discord API server
* fix: Handle ready emitting in onPacket
Doesn't allow broken packets
* misc: Close the connection if Discord asks for a reconnect
Prevents double triggers
* testing: Prevent multiple reconnect attempts on a shard
Should fix some issues some people have had.
* fix: Prevent multiple reconnect calls on the shard, re-use conn to identify, remove reconnect function
Note: Closing the WS with 1000 makes the session invalid
* misc: Forgot to remove 2 unneeded setters
* docs: Wrong param docstring for WebSocketShard#destroy
* misc: Set status to reconnecting after destroying
* misc: Close connection with code 1000 on session invalidated
Allows us to cleanup the shard and do a full reconnect
Also remove identify wait delay, not used anywhere
* fix: Fix zlib crash on node
And with that, the PR is done!
* misc: Implement a reconnect queue
And that is all there was to be done in this PR.
Shards now queue up for a reconnect
* nit: Debug the queue after destroying
* docs: Make the invalidated event clearer
* lint: I'm good at my job
* docs
* docs: Make description for isReconnectingShards accurate
*can I stop finding issues, this PR is meant to be done*
* misc: Remove shard from bind params
* misc: Code re-ordering and cleanup
Resumes do not need to be queued up, as they do not count to the identify limit, and after some testing, they don't have the 5 second delay required, like in identify
* fix: Issues with token regeneration and shards not properly handling them
We close the ws connection with code 1000 if we get an invalid session payload,
that way we can queue the reconnects and handle any issues
* misc: Remove useless delays on session invalidated
They get handled by the rest of the code already
* lint
* misc: reset the sequence on Shard#destroy
This especially is a problem if you need to re-identify, as the sequence doesn't get set to the current one,
causing the sequence to be wrong
* fix: GitHub rebase and minor tweak
* Implement a 15 second timeout if shards don't connect till then
Should prevent shards that never reconnect
* revert: Make WebSocketShard#send and WebSocketManager#broadcast public
* typings: Set type to void instead of undefined
* docs: Requested Changes
- Fixed a bug where `GuildMemberRoleStore#{add,remove}` would create a rejected promise inside a promise, instead of rejecting the first one.
- Fixed a bug where `GuildMember#edit` with a specified unknown channel would throw synchronously, instead of rejecting asynchronously.
* feat({Role,Channel}Store): fetch method
* docs: Add usage examples to the new methods
* misc: Add note of why we are fetching all roles even for a single one
This PR attempts to fix the reported resumed event count in the debug output (where it is always displayed only as 1 event replayed) and in the emitted `resumed` event, where it passed the current sequence instead of passing the actual replayed event count (which was an utopic high number for smaller bots on resume).
* fix(Util): throw an explicit error if a chunk exceeds the max length
* refactor(Util): consolidate both errors in splitMessage into one
* revert(Messages): do not unnecessarily change the error code
* revert(Messages): do not remove the word 'the'
* Add explicit error to setting invalid voice channel
* restrict to guild
Co-Authored-By: Darqam <anhim2@gmail.com>
* add a more explicit error and channel type check
* bad tab