Commit Graph

3787 Commits

Author SHA1 Message Date
Linn Dahlgren
7006f00ae4 feat(MessageEmbed): add missing proxyURL property to video (#3109)
* Added missing property to MessageEmbed.video

* Updated typings for MessageEmbed.video
2019-02-24 09:27:57 +01:00
Kyra
bc0a761e22 typings: Convert types to interfaces where applicable (#3068) 2019-02-23 22:14:09 -06:00
Linn Dahlgren
4d3f76656a docs(MessageEmbed): add missing type value (#3106) 2019-02-23 10:05:04 +01:00
Amish Shah
73be952406 use official release of prism 2019-02-21 11:56:46 +00:00
Amish Shah
efbbfbcec6 fix #3102 2019-02-20 19:15:33 +00:00
Amish Shah
6aa792f9ab voice: cleanup internals whether end() or destroy() is called 2019-02-19 13:16:48 +00:00
Amish Shah
4009986bc8 voice: destroy opus 2019-02-17 21:48:47 +00:00
Amish Shah
0564c5c777 voice: update prism 2019-02-14 16:57:26 +00:00
SpaceEEC
4289b18ab2 docs(GuildMember): add missing @name to document user property
Fixes #3090
2019-02-14 11:19:05 +01:00
Amish Shah
5c3f5d7048 Partials (#3070)
* 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
2019-02-13 17:39:39 +00:00
Amish Shah
8910fed729 voice: debug UDP (#3044) 2019-02-12 16:29:11 +00:00
Kyra
5c19ad7252 cleanup: Error messages cleanup (#3079)
Removed keys that return zero occurrences in the library's source code
2019-02-12 08:13:15 +00:00
Kyra
0c7a618f10 cleanup: remove unused members of classes (#3078)
* cleanup: Remove unused members of classes

* typings: Remove hit from Message
2019-02-11 20:33:13 +01:00
Amish Shah
c362ba0dd5 voice: more debug 2019-02-11 18:37:33 +00:00
Amish Shah
fe51b4e89b voice: more debug information, correctly listen to vws 2019-02-11 18:28:37 +00:00
Amish Shah
375706beac voice: replace self.xyz events 2019-02-11 18:03:35 +00:00
Amish Shah
810b5a5f71 voice: more debug info 2019-02-11 17:57:56 +00:00
Amish Shah
283fc54ce4 More debug information 2019-02-11 17:39:19 +00:00
Amish Shah
a705edfd0d voice: more debug information 2019-02-11 17:22:17 +00:00
Kyra
ab55acffdb webpack: Fix module warning when building (#3076)
Warning:
```
WARNING in ./src/client/Client.js
Module not found: Error: Can't resolve 'worker_threads' in 'D:\Repositories\discordjs\discord.js\src\client'
 @ ./src/client/Client.js
 @ ./src/index.js
```
2019-02-11 16:29:20 +00:00
Kyra
0c5b9c6870 chore(deps): Updated all required, peer, and development dependencies (#3073)
* 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
2019-02-11 07:41:37 +00:00
Amish Shah
aab3523fb5 voice: more debug information
#3074, #2979, #3044
2019-02-10 20:18:08 +00:00
Vlad Frangu
793341dbb4 fix: Sharding issues, silent disconnects and code cleanup (#2976)
* 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
2019-02-10 16:28:03 +00:00
SpaceEEC
7324a993ed fix: ensure VIEW_CHANNEL permissions before trying to join (#3046)
* fix: ensure VIEW_CHANNEL permissions before joining

* nit(GuildChannel): remove the redundant truthy check
2019-02-10 15:21:59 +00:00
Atlas
ff95e587cb Better wording (#3032) 2019-02-09 23:53:47 +00:00
Kyra
d057a5040c ci: Test in Node.js 10 and 11, deploy with Node.js 10 (#3069) 2019-02-09 23:51:23 +00:00
Kyra
9449f8df8f cleanup(GuildMember{RoleStore}): Rewrite to async/await (#3072)
- 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.
2019-02-09 17:20:10 +00:00
Kyra
c432591113 feat(RoleStore, ChannelStore): fetch() method (#3071)
* 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
2019-02-09 15:07:31 +00:00
Kyra
ae7269088b typings(ShardClientUtil): fix id property type (#3054)
Ref: d98d464d74/src/sharding/ShardClientUtil.js (L50)
2019-02-06 18:15:05 +01:00
Amish Shah
f826c9c75e voice: workaround for receiving audio
(#2929 and discordapp/discord-api-docs#808)
2019-02-05 10:26:16 +00:00
Kyra
d98d464d74 typings(GuildCreateChannelOptions): added missing properties (#3052)
* typings(GuildCreateChannelOptions): Added missing properties

* typings: Added `GuildChannelCloneOptions`
2019-02-04 17:57:13 +01:00
Kyra
dd8ba00af4 misc(index): export HTTPError class (#3051) 2019-02-04 16:44:21 +01:00
Isabella
75e264da57 feat: Presence#clientStatus (#2997)
* feat: Presence#clientStatus

* fix Presence#equals check

* fix typings

* vlad changes

* presence consistency docs

* fix docs

* fix big docs fail
2019-02-02 20:29:47 +01:00
Rattmann (fallen)
1db78994dd feat: MessageEmbed#length (#3003)
* add MessageEmbed#length

* update typings (+MessageEmbed#length)

* eslint: L181 (max line length), L183 (missing semi)

* eslint: L181 (trailing space)
2019-02-02 20:29:10 +01:00
SpaceEEC
db3ae0159b docs(Structures): note about extending prior to instantiating client (#2884) 2019-02-02 20:28:24 +01:00
Marcel Menzel
f2ed93c08a fix(WebSocketShard): report correct resumed event count (#3019)
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).
2019-02-02 11:28:45 +01:00
Kyra
2dcdc798ac typings: add missing ImageSize numbers (#3045)
To match the JS typedef: https://discord.js.org/#/docs/main/master/typedef/ImageURLOptions
2019-02-02 10:42:13 +01:00
Anthony Collier
3dff5058f0 docs(Examples): fix usage of removed overload of Collection#find (#3027) 2019-01-21 17:22:24 +01:00
Isabella
8230255c68 fix(ShardClientUtil#id): erroneously reporting as an array 2019-01-15 01:45:29 -06:00
SpaceEEC
28db527370 docs(Guild): use 'updated' variable in example for setRegion 2019-01-10 16:54:02 +01:00
SpaceEEC
840d22f892 docs(Webhook): add mising '@name' to Webhook#token's docstring 2018-12-30 12:52:33 +01:00
Amish Shah
0bde9ca2c5 voice: set seek parameter before input (#2993) 2018-12-27 18:05:54 +00:00
Kyra
8a76cc5c72 typings(TextBasedChannel): add Snowflake[] overload to bulkDelete (#3001)
* typings: Add `string[]` overload to bulkDelete

* misc: Requested changes
2018-12-25 22:00:46 +01:00
Lucas Kellar
8286d1a0fc typings(SnowflakeUtil): add optional "timestamp" parameter to generate (#2998) 2018-12-23 23:16:28 +01:00
SpaceEEC
21ec03140f feat(GuildChannelStore): add support for create to accept a position (#2965) 2018-12-22 08:50:33 +01:00
Will Nelson
5cbdf38028 fix(WebSocketShard): add websocket send error handling (#2981)
* websocket send error handling

* fix: emit only when error is present

* refactor: use an if instead
2018-12-22 08:49:56 +01:00
August
b5d5c699e6 fix: guildBanRemove event name (#2983)
- "Events.GUILD_BAN_REMOVEGUILD_BAN_REMOVE" -> "Events.GUILD_BAN_REMOVE"
2018-12-09 09:30:46 +01:00
Gus Caplan
42505b78c1 chore: add strict mode (#2974) 2018-12-03 15:19:10 -06:00
SpaceEEC
ecaec29380 fix(Util): throw an explicit error if a chunk exceeds the max length (#2936)
* 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'
2018-11-27 21:42:28 +01:00
Darqam
23a16c3a73 fix(GuildChannel): add explicit channel resolve error to member edit (#2958)
* 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
2018-11-27 21:41:34 +01:00