Skip to content

Commit 1f799a4

Browse files
authored
update from stable (#1)
* Docs: document ChannelData.parent and .permissionOverwrites, fix typedefs to not include Collection of ChannelCreationOverwrite (discordjs#2734) * document ChannelData.parent * document ChannelData.permissionOverwrites * Overwrites also take other things, account for it * note to self: stop copy-pasting * remove eslint madness, fix param defs * fix property slip * Bump to 11.4.2 * refactor: Merge typings into 11.4-dev branch * fix(Message): properly check for an edited_timestamp in patch Fixes discordjs#2750 * fix(Permissions): Permissions itself is a valid PermissionResolvable fixes discordjs#2753 * typings: make PermissionResolvable recursive * backport: handle async stacktraces correctly (discordjs#2768) * fix: WebhookClient should handle ratelimits properly * fix: pin & update deps * fix: disable getter-return * fix(webpack): properly emitting process deprecation warnings * backport: User#dmChannel perf enhancement (discordjs#2780) * docs(Emoji): fix typo of the word "emoji" (discordjs#2791) * fix: Guild#addMember incorrectly resolving userID * backport: WEBHOOKS_UPDATE event (discordjs#2779) * typings: add WEBHOOKS_UPDATE * typings: clean up permissionResolvable * backport: Deprecate allowed/denied as discordjs#2765 (discordjs#2792) * fix(GuildChannel#lockPermissions): Properties allow and deny always returning undefined (discordjs#2800) * fix undefined properties * requested changes * backport: `GUILD_INTEGRATIONS_UPDATE` event (discordjs#2794) * backport: Client#on{guildIntegrationsUpdate,webhookUpdate} misc: Update Constants.WSEvents and WSEventType backport: Add guildIntegrationsUpdate event handler * docs: Updated typings * backport: Guild#{fetchEmbed,setEmbed} (discordjs#2778) * backport: Guild Embeds * fix: Added missing return * docs: Updated typings * backport: UNKNOWN_WEBHOOK (discordjs#2777) * docs: Added `url` to Invite's warning comment (discordjs#2804) And added the [serial comma](https://en.wikipedia.org/wiki/Serial_comma) * fix(Guild#deleteEmoji): reject non emojis / emoji IDs (discordjs#2793) * fix(Guild#deleteEmoji): Performing wrong checks * fix: requested changes `a string` -> `an id` * fix: requested changes `id` -> `ID` * docs: correct Guild#memberCount (discordjs#2812) * build(peer-deps): use uws fork backport (discordjs#2782) * build(peer-deps): uws backport * chore: update to 149 for uws * docs(User): clarify what User#tag represents Closes discordjs#2828 * backport(ClientOptions): add retryLimit (discordjs#2869) * backport: rateLimitPerUser (discordjs#2874) * backport(Guild): add fetchVanityCode (discordjs#2871) * docs(Game): document possible values for type property See discordjs#2865 * typings: fix lint script and linter errors * backport(TextBasedChannel): add lastPinTimestamp and lastPinAt (discordjs#2870) And clarify Client#channelPinsUpdate's 'time' parameter. * backport(Guild): support for createChannel with options object (discordjs#2888) * fix: revert discordjs#2768 (discordjs#2848) * fix: revert discordjs#2768 * fix merge * Fix discordjs#2928 (member not being removed from voice channel after leaving guild) * fix:(GuilChannel): clone method not taking overwrites into account (discordjs#2932) * docs(GuildChannel): add rateLimitPerUser to ChannelData typdef * backport(Guild): support for rateLimitPerUser when creating a channel PR: discordjs#2878 Commit: 8ec3b51 * typings(RichEmbed): add MessageEmbed as valid data in constructor See discordjs#2970 * docs:(TextChannel): add documentation for messages and lastMessage (discordjs#2986) * [docs] add missing docs for <TextChannel>.messages * add missing doc for <TextChannel>.lastMessage * fix(TextBasedChannel): added missing lastMessage functionality in textchannels (discordjs#2999) * docs(Webhook): add mising '@name' to Webhook#token's docstring * typings(Guild): fix typos in method names Fixes discordjs#3009 * typings(TextBasedChannel): fix create(Message)Collector's options type * docs(Guild): use AuditLogAction for fetchAuditLogs' type option * docs(Client): add missing parenthesis in fetchInvite example (discordjs#3023) This is already fixed in master, resolves discordjs#3022 * docs(Client): add missing example tag and closing parenthesis (discordjs#3024) * fix(Guild): ignore voice states referencing an invalid channel This was causing an uncaught exception on startup (or whenever receiving such a payload) which is crashing the process. * typings(SnowflakeUtil): add optional "timestamp" parameter to generate (discordjs#2998) * feat(Constants): add error code 50020 (discordjs#2953) * feat(Constants): Add error code 50020 Which is throw when using the vanity-url endpoint: discord/discord-api-docs#748 * docs: Document the new code * feat(Util): add WHITE as color resolvable (discordjs#3062) * feat(Presence): add clientStatus (discordjs#3056) * feat(RichEmbed): add length getter (discordjs#3057) * feat(Guild): add position to createChannel's implementation (discordjs#3058) * fix(GuildMember): add explicit channel resolve error to member edit (discordjs#3059) * fix(Util): splitMessage throws an error if a chunk is too large (discordjs#3060) * feat(RichEmbed): add timestamp support for setTimestamp (discordjs#3061) * fix(Emoji): reject explicit error when MANAGE_EMOJI permissions are missing (discordjs#3063) * Mark peer dependencies as optional (discordjs#3066) * docs(Guild): update createChannel examples to not use deprecated overload * fix typo * docs/typings: RateLimitInfo#limit instead of requestLimit (discordjs#3132) * fix doc for ratelimit data, fixes discordjs#3131 * adapt typings * typings: unindent #region comments * fix discordjs#3150: can now create dispatcher with 0 volume * feat(Guild): add fetchBan and withReasons to fetchBans (discordjs#3170) * add Guild#fetchBan() & backport BanInfo * and the typings * requested changes * typings overloads Co-Authored-By: izexi <[email protected]> * nullable reason typings Co-Authored-By: izexi <[email protected]> * typings(Collection): add typings for partition (discordjs#3166) * fix(Guild): sort roles with the same position in the correct order (discordjs#3184) * docs(Collection): fix findKey jsdoc (discordjs#3204) * typings(GuildChannel): add manageable getter * fix(WebSocketConnection): stringify data when no websocket is available [object Object] is not really descriptive * fix/docs(Client): type status and do not throw an error if accessed before login * feat(GuildMember): add support for voice kicking (discordjs#3246) This backports e64773e (discordjs#3242) * Backport news/store channels * Remove unnecessary import * Add news/store channel support to CHANNEL_CREATE * Document news/store channel types on Guild#createChannel * Update typings for news/store channels * Add testing for Node.js 8-12 * Bump version to 11.5.0 * docs(Guild): fix typo in example of createChannel * docs(TextChanne): specify unit of rateLimitPerUser (discordjs#3272) * Update TextChannel.js Update `setRateLimitPerUser` description to specify the `number` is in seconds, per the Discord docs * Update TextChannel.js Add unit to the rateLimitPerUser property * Update GuildChannel.js * docs(ChannelCreationOverwrites): revert incorrect rename of "id" property (discordjs#3273) Reverts one incorrect change made in discordjs#2734 (discordjs@3021e5c#diff-e5c54069adfa0d32480eb3cc9faeee20L979) * Fix incorrect docs in Guild.js * Update src/structures/Guild.js Co-Authored-By: SpaceEEC <[email protected]> * Update Guild.js * fix(GuildMember): do not create a channel key when editing This is to not break GuildMember#setNickname for the current user * fix(Message#pinnable): you can't pin system messages (discordjs#3279) * chore: explicitly mark everything deprecated as `@ deprecated` (discordjs#3307) * v11.5.1
1 parent b5df860 commit 1f799a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3037
-157
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"no-undef-init": "error",
7878

7979
"callback-return": "error",
80+
"getter-return": "off",
8081
"handle-callback-err": "error",
8182
"no-mixed-requires": "error",
8283
"no-new-require": "error",

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ webpack/
2424
webpack.config.js
2525
.github/
2626
test/
27+
tsconfig.json
28+
tslint.json

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
language: node_js
22
node_js:
33
- "6"
4-
- "7"
4+
- "8"
5+
- "10"
6+
- "12"
57
cache:
68
directories:
79
- node_modules

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ For production bots, using node-opus should be considered a necessity, especiall
4444
- One of the following packages can be installed for faster voice packet encryption and decryption:
4545
- [sodium](https://www.npmjs.com/package/sodium) (`npm install sodium`)
4646
- [libsodium.js](https://www.npmjs.com/package/libsodium-wrappers) (`npm install libsodium-wrappers`)
47-
- [uws](https://www.npmjs.com/package/uws) for a much faster WebSocket connection (`npm install uws`)
47+
- [uws](https://www.npmjs.com/package/@discordjs/uws) for a much faster WebSocket connection (`npm install @discordjs/uws`)
4848

4949
## Example usage
5050
```js

docs/general/updating.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Version 11.5.0
2+
v11.5.0 backports new features from the in-development v12, and fixes bugs in the v11.4.x releases.
3+
See [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.5.0) for a full list of changes, including information about deprecations.
4+
15
# Version 11.4.0
26
v11.4.0 backports many new features such as Rich Presence and bugfixes from v11.3.0.
37
See [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.4.0) for a full list of changes, including information about deprecations.

docs/general/welcome.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
</div>
1919

2020
# Welcome!
21-
Welcome to the discord.js v11.4 documentation.
22-
The v11.4 release contains bugfixes from v11.3 and backports features such as Rich Presence.
21+
Welcome to the discord.js v11.5 documentation.
22+
The v11.5 release contains bugfixes from v11.4 and backports features from the in-development v12.
2323

2424
v12 is still very much a work-in-progress, as we're aiming to make it the best it can possibly be before releasing.
2525
If you are fond of living life on the bleeding-edge, check out the master branch.
@@ -52,7 +52,7 @@ For production bots, using node-opus should be considered a necessity, especiall
5252
- One of the following packages can be installed for faster voice packet encryption and decryption:
5353
- [sodium](https://www.npmjs.com/package/sodium) (`npm install sodium`)
5454
- [libsodium.js](https://www.npmjs.com/package/libsodium-wrappers) (`npm install libsodium-wrappers`)
55-
- [uws](https://www.npmjs.com/package/uws) for a much faster WebSocket connection (`npm install uws`)
55+
- [uws](https://www.npmjs.com/package/@discordjs/uws) for a much faster WebSocket connection (`npm install @discordjs/uws`)
5656

5757
## Example usage
5858
```js

docs/topics/web.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The usage of the API isn't any different from using it in Node.js.
2323

2424
## Example
2525
```html
26-
<script type="text/javascript" src="discord.11.4.1.min.js"></script>
26+
<script type="text/javascript" src="discord.11.5.0.min.js"></script>
2727
<script type="text/javascript">
2828
const client = new Discord.Client();
2929

package.json

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "discord.js",
3-
"version": "11.4.1",
3+
"version": "11.5.1",
44
"description": "A powerful library for interacting with the Discord API",
55
"main": "./src/index",
66
"types": "./typings/index.d.ts",
@@ -10,6 +10,7 @@
1010
"docs:test": "docgen --source src --custom docs/index.yml",
1111
"lint": "eslint src",
1212
"lint:fix": "eslint --fix src",
13+
"lint:typings": "tslint typings/index.d.ts typings/discord.js-test.ts",
1314
"webpack": "parallel-webpack"
1415
},
1516
"repository": {
@@ -36,31 +37,58 @@
3637
"prism-media": "^0.0.3",
3738
"snekfetch": "^3.6.4",
3839
"tweetnacl": "^1.0.0",
39-
"ws": "^4.0.0"
40+
"ws": "^6.0.0"
4041
},
4142
"peerDependencies": {
42-
"bufferutil": "^3.0.3",
43+
"@discordjs/uws": "^10.149.0",
44+
"bufferutil": "^4.0.0",
4345
"erlpack": "discordapp/erlpack",
46+
"libsodium-wrappers": "^0.7.3",
4447
"node-opus": "^0.2.7",
4548
"opusscript": "^0.0.6",
46-
"sodium": "^2.0.3",
47-
"libsodium-wrappers": "^0.7.3",
48-
"uws": "^9.14.0"
49+
"sodium": "^2.0.3"
50+
},
51+
"peerDependenciesMeta": {
52+
"bufferutil": {
53+
"optional": true
54+
},
55+
"erlpack": {
56+
"optional": true
57+
},
58+
"node-opus": {
59+
"optional": true
60+
},
61+
"opusscript": {
62+
"optional": true
63+
},
64+
"sodium": {
65+
"optional": true
66+
},
67+
"libsodium-wrappers": {
68+
"optional": true
69+
},
70+
"uws": {
71+
"optional": true
72+
}
4973
},
5074
"devDependencies": {
5175
"@types/node": "^9.4.6",
5276
"discord.js-docgen": "discordjs/docgen",
53-
"eslint": "^4.18.0",
54-
"parallel-webpack": "^2.2.0",
55-
"uglifyjs-webpack-plugin": "^1.2.0",
56-
"webpack": "^3.11.0"
77+
"eslint": "^5.4.0",
78+
"parallel-webpack": "^2.3.0",
79+
"tslint": "^3.15.1",
80+
"tslint-config-typings": "^0.2.4",
81+
"typescript": "^3.0.1",
82+
"uglifyjs-webpack-plugin": "^1.3.0",
83+
"webpack": "^4.17.0"
5784
},
5885
"engines": {
5986
"node": ">=6.0.0"
6087
},
6188
"browser": {
6289
"ws": false,
6390
"uws": false,
91+
"@discordjs/uws": false,
6492
"erlpack": false,
6593
"prism-media": false,
6694
"opusscript": false,

src/client/Client.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class Client extends EventEmitter {
116116
* Presences that have been received for the client user's friends, mapped by user IDs
117117
* <warn>This is only filled when using a user account.</warn>
118118
* @type {Collection<Snowflake, Presence>}
119+
* @deprecated
119120
*/
120121
this.presences = new Collection();
121122

@@ -186,11 +187,11 @@ class Client extends EventEmitter {
186187

187188
/**
188189
* Current status of the client's connection to Discord
189-
* @type {?number}
190+
* @type {Status}
190191
* @readonly
191192
*/
192193
get status() {
193-
return this.ws.connection.status;
194+
return this.ws.connection ? this.ws.connection.status : Constants.Status.IDLE;
194195
}
195196

196197
/**
@@ -296,6 +297,7 @@ class Client extends EventEmitter {
296297
* <info>This can be done automatically every 30 seconds by enabling {@link ClientOptions#sync}.</info>
297298
* <warn>This is only available when using a user account.</warn>
298299
* @param {Guild[]|Collection<Snowflake, Guild>} [guilds=this.guilds] An array or collection of guilds to sync
300+
* @deprecated
299301
*/
300302
syncGuilds(guilds = this.guilds) {
301303
if (this.user.bot) return;
@@ -323,7 +325,7 @@ class Client extends EventEmitter {
323325
* @returns {Promise<Invite>}
324326
* @example
325327
* client.fetchInvite('https://discord.gg/bRCvFy9')
326-
* .then(invite => console.log(`Obtained invite with code: ${invite.code}`)
328+
* .then(invite => console.log(`Obtained invite with code: ${invite.code}`))
327329
* .catch(console.error);
328330
*/
329331
fetchInvite(invite) {
@@ -395,8 +397,9 @@ class Client extends EventEmitter {
395397
* <warn>Bots can only fetch their own profile.</warn>
396398
* @param {Snowflake} [id='@me'] ID of application to fetch
397399
* @returns {Promise<OAuth2Application>}
400+
* @example
398401
* client.fetchApplication()
399-
* .then(application => console.log(`Obtained application with name: ${application.name}`)
402+
* .then(application => console.log(`Obtained application with name: ${application.name}`))
400403
* .catch(console.error);
401404
*/
402405
fetchApplication(id = '@me') {
@@ -509,7 +512,7 @@ class Client extends EventEmitter {
509512
* @param {ClientOptions} [options=this.options] Options to validate
510513
* @private
511514
*/
512-
_validateOptions(options = this.options) {
515+
_validateOptions(options = this.options) { // eslint-disable-line complexity
513516
if (typeof options.shardCount !== 'number' || isNaN(options.shardCount)) {
514517
throw new TypeError('The shardCount option must be a number.');
515518
}
@@ -540,6 +543,9 @@ class Client extends EventEmitter {
540543
throw new TypeError('The restWsBridgeTimeout option must be a number.');
541544
}
542545
if (!(options.disabledEvents instanceof Array)) throw new TypeError('The disabledEvents option must be an Array.');
546+
if (typeof options.retryLimit !== 'number' || isNaN(options.retryLimit)) {
547+
throw new TypeError('The retryLimit options must be a number.');
548+
}
543549
}
544550
}
545551

0 commit comments

Comments
 (0)