* feat(voice): kick members from voice channels
* fix(VoiceState): improve stability in checking for client user
* feat(VoiceState): add setChannel for moving/kicking members
* update typings
* remove duplicated methods across GuildMember and VoiceState
member.setDeaf => member.voice.setDeaf
member.setMute => member.voice.setMute
member.setVoiceChannel => member.voice.setChannel
* src: Implement store and news channels!
* src: Remove code dupe
* src: Add missing guild properties
* docs: Add a small notice that the channel type may also change
* src: Remove re-creation of the MessageStore
* lint: Unused Import
* src: Requested changes for StoreChannels
* typings: Fix typings
* src: Moar guild updates
* src: Set maximumPresence to the data prop, the already existent one, or default to 5000
* typings: afkChannel is a VC
I keep confusing them, ffs
Co-Authored-By: vladfrangu <kingdgrizzle@gmail.com>
* docs: Document that maximumMembers and maximumPresences may be inaccurate before fetching
* src Appels requested changes
* add a public alternative to the private raw event
while retaining raw for use in debugging privately
* only emit dispatch packets
* requested changes
TIL, that's neat
* fix padding
* requested changes
* Update WebSocketManager.js
* docs: document constructors of extendible structures
* docs(ClientPresence): document default value for data parameter
Co-Authored-By: SpaceEEC <spaceeec@yahoo.com>
* docs(Presence): document default value for data parameter
Co-Authored-By: SpaceEEC <spaceeec@yahoo.com>
* docs(DMChannel): capitalize DM in the constructor doc
* docs: make voice public
* typings: Update typings to match the docs
* typings: ClientVoiceManager is nullable in Client
Co-Authored-By: vladfrangu <kingdgrizzle@gmail.com>
* typings: Mark client as readonly
Co-Authored-By: vladfrangu <kingdgrizzle@gmail.com>
* src: Make the client readonly
* src: Remove Client#voiceConnections getter in favor of ClientVoiceManager#connections
* src: WIP Internal Sharding refactor
* src: Refactor unavailable guild check
Co-Authored-By: kyranet <kyradiscord@gmail.com>
* src: More WIP Code
F in the chat to the old manager
* src: It should work but Discord says no.
Seriously why is this not working!
* fix: Inflator causing issues
* src: Finishing touches and typings
* misc: Proper debug message
* fix: Making things hidden needs writable: true as well
* fix: Sharding allowing multiple of the same shard, negative shards or strings
* fix: Again... edge cases
I love you guys .w.
* misc: Touchups
* misc: Better error?
* docs: Typo
* typings: Requested changes
* src: Requested changes
* src: Fix issues, validate provided shard options and more
* src: Forgot to remove the listener
* lint: eslint complaining
* fix: Setting shardCount to auto crashing the process
* misc: Requested changes
* typings: Correct typings for shardCount client option
* typings: Add invalidSession event to the shard and correct typings
* src: Minor docs adjustements, and code consistency between setHelloTimeout and setHeartbeatTimeout
* src: Don't block reconnect while creating shards
Might fix silent disconnects *again*
* src: Prevent reconnect from running if the Manager isn't READY
That way, if a shard dies while we're still spawning, it won't cause issues
* fix: Retry to reconnect if there's a network error going on.
The manager *should* keep reconnecting unless the token is invalid
* src: Enhance onClose handler for shards in the manager
- If the close code is between 1000 and 2000 (inclusive), you cannot resume
I tested this locally
- If there's a session ID still present, immediately try to resume
Faster resumes :papaBless:
Otherwise, the invalid session event will trigger and it'll handle accordingly
I swear if I see a SINGULAR Silent DC I'm yeeting
* src: Fix error check
* src: Make sure message exists on the error
* src: Used the wrong property for the shardQueue
* src: Make the hello timeout be made by the client
god help
* docs: Correct docs for WSEvents
* misc: Remove old events from the Events constant
* src: Throw the HTTP error if we don't get a 401
* typings: Can't forget about them
* src: Implement some more fail safes just in case
Seriously, better safe than sorry! Gotta failproof it completely
* edit shouldn't remove content
If undefined is passed to the api, content isn't removed in such a case where you are only editing the embed.
* fix a related doc string
* update typings
* requested changes
* 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
* 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
* 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