diff --git a/docs/general/updating.md b/docs/general/updating.md index 2926691ab..d1087207e 100644 --- a/docs/general/updating.md +++ b/docs/general/updating.md @@ -1,3 +1,22 @@ +# Version 11 + +**Significant Additions (see the changelog for a full list):** +* Message Reactions and Embeds (rich text) +* Support for uws and erlpack for better performance +* OAuthApplication support + +### 1) Client.login() no longer supports logging in with email + password +Logging in with an email or password has been discouraged previously, mainly because of [this](https://github.com/hammerandchisel/discord-api-docs/issues/69#issuecomment-223886862), however we have made the decision to now remove all email and password logins in v11. Instead, you can use authentication tokens. You can find your token for a self-bot by entering `CTRL+SHIFT+I` in the Discord application, entering the console tab and executing `localStorage.token`. As always, you can get your token for real bot accounts [here.](https://discordapp.com/developers/applications/me) + +### 2) ClientUser.setEmail()/setPassword() now require the current password, as well as setUsername() on user accounts +In order to change email, password or username on user accounts (self-bots), you need to now pass a password parameter to these methods (changes highlighted in documentation for ClientUser). + +### 3) Removed TextBasedChannel.sendTTSMessage() +This method was redundant and has been removed as the same results can be achieved using sendMessage() + +### 4) Using Collection.find()/exists() with IDs will throw an error +To find something or check its existence using an ID, you should now use `.get()` and `.has()` which are part of a normal [Map.](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) + # Version 10 Version 10's non-BC changes focus on cleaning up some inconsistencies that exist in previous versions. Upgrading from v9 should be quick and painless. diff --git a/docs/general/welcome.md b/docs/general/welcome.md index cb72c85a9..c7791f3da 100644 --- a/docs/general/welcome.md +++ b/docs/general/welcome.md @@ -17,8 +17,8 @@ # Welcome! -Welcome to the discord.js v10 documentation. -v10 is just a more consistent and stable iteration over v9, and contains loads of new and improved features, optimisations, and bug fixes. +Welcome to the discord.js v11 documentation. +v11 contains loads of new and improved features, optimisations, and bug fixes. ## About discord.js is a powerful node.js module that allows you to interact with the diff --git a/package.json b/package.json index f9a466282..22518cb59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord.js", - "version": "10.0.1", + "version": "11.0.0", "description": "A powerful library for interacting with the Discord API", "main": "./src/index", "types": "./typings/index.d.ts", diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index d5d82e4f5..70062482e 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -47,9 +47,9 @@ class RESTMethods { if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content); if (content) { - if (typeof code === 'string') { + if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) { content = escapeMarkdown(this.client.resolver.resolveString(content), true); - content = `\`\`\`${typeof code !== 'undefined' && code !== null ? code : ''}\n${content}\n\`\`\``; + content = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n${content}\n\`\`\``; } if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) { @@ -59,7 +59,7 @@ class RESTMethods { if (split) content = splitMessage(content, typeof split === 'object' ? split : {}); } - const send = (chan) => { + const send = chan => { if (content instanceof Array) { const messages = []; (function sendChunk(list, index) { @@ -87,9 +87,9 @@ class RESTMethods { updateMessage(message, content, { embed, code } = {}) { content = this.client.resolver.resolveString(content); - if (code) { + if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) { content = escapeMarkdown(this.client.resolver.resolveString(content), true); - content = `\`\`\`${typeof code !== 'undefined' && code !== null ? code : ''}\n${content}\n\`\`\``; + content = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n${content}\n\`\`\``; } return this.rest.makeRequest('patch', Constants.Endpoints.channelMessage(message.channel.id, message.id), true, { content, embed, diff --git a/src/structures/DMChannel.js b/src/structures/DMChannel.js index abf197e4b..de49c8b3f 100644 --- a/src/structures/DMChannel.js +++ b/src/structures/DMChannel.js @@ -37,8 +37,8 @@ class DMChannel extends Channel { } // These are here only for documentation purposes - they are implemented by TextBasedChannel + send() { return; } sendMessage() { return; } - sendTTSMessage() { return; } sendEmbed() { return; } sendFile() { return; } sendCode() { return; } diff --git a/src/structures/GroupDMChannel.js b/src/structures/GroupDMChannel.js index ada3a90f4..84fe4f994 100644 --- a/src/structures/GroupDMChannel.js +++ b/src/structures/GroupDMChannel.js @@ -121,8 +121,8 @@ class GroupDMChannel extends Channel { } // These are here only for documentation purposes - they are implemented by TextBasedChannel + send() { return; } sendMessage() { return; } - sendTTSMessage() { return; } sendEmbed() { return; } sendFile() { return; } sendCode() { return; } diff --git a/src/structures/Message.js b/src/structures/Message.js index ab6a82899..7fcc5b4b8 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -369,7 +369,7 @@ class Message { * Options that can be passed into editMessage * @typedef {Object} MessageEditOptions * @property {Object} [embed] An embed to be added/edited - * @property {string} [code] Language for optional codeblock formatting to apply + * @property {string|boolean} [code] Language for optional codeblock formatting to apply */ /** diff --git a/src/structures/MessageReaction.js b/src/structures/MessageReaction.js index 263f2b6b7..30c555f9d 100644 --- a/src/structures/MessageReaction.js +++ b/src/structures/MessageReaction.js @@ -56,7 +56,7 @@ class MessageReaction { /** * Removes a user from this reaction. - * @param {UserResolvable} [user] the user that you want to remove the reaction, defaults to the client. + * @param {UserResolvable} [user=this.message.client.user] User to remove the reaction of * @returns {Promise} */ remove(user = this.message.client.user) { @@ -69,8 +69,7 @@ class MessageReaction { } /** - * Fetch all the users that gave this reaction. Resolves with a collection of users, - * mapped by their IDs. + * Fetch all the users that gave this reaction. Resolves with a collection of users, mapped by their IDs. * @param {number} [limit=100] the maximum amount of users to fetch, defaults to 100 * @returns {Promise>} */ diff --git a/src/structures/interface/TextBasedChannel.js b/src/structures/interface/TextBasedChannel.js index 536131332..353c0a9cf 100644 --- a/src/structures/interface/TextBasedChannel.js +++ b/src/structures/interface/TextBasedChannel.js @@ -33,7 +33,7 @@ class TextBasedChannel { * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here * should be replaced with plain-text * @property {FileOptions|string} [file] A file to send with the message - * @property {string} [code] Language for optional codeblock formatting to apply + * @property {string|boolean} [code] Language for optional codeblock formatting to apply * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if * it exceeds the character limit. If an object is provided, these are the options for splitting the message. */ @@ -55,8 +55,8 @@ class TextBasedChannel { /** * Send a message to this channel - * @param {StringResolvable} [content] The content to send - * @param {MessageOptions} [options={}] The options to provide + * @param {StringResolvable} [content] Text for the message + * @param {MessageOptions} [options={}] Options for the message * @returns {Promise} * @example * // send a message @@ -94,8 +94,8 @@ class TextBasedChannel { /** * Send a message to this channel - * @param {StringResolvable} content The content to send - * @param {MessageOptions} [options={}] The options to provide + * @param {StringResolvable} content Text for the message + * @param {MessageOptions} [options={}] Options for the message * @returns {Promise} * @example * // send a message @@ -109,9 +109,9 @@ class TextBasedChannel { /** * Send an embed to this channel - * @param {RichEmbed|Object} embed The embed to send - * @param {string} [content] Content to send - * @param {MessageOptions} [options] The options to provide + * @param {RichEmbed|Object} embed Embed for the message + * @param {string} [content] Text for the message + * @param {MessageOptions} [options] Options for the message * @returns {Promise} */ sendEmbed(embed, content, options) { @@ -126,10 +126,10 @@ class TextBasedChannel { /** * Send a file to this channel - * @param {BufferResolvable} attachment The file to send - * @param {string} [name='file.jpg'] The name and extension of the file - * @param {StringResolvable} [content] Text message to send with the attachment - * @param {MessageOptions} [options] The options to provide + * @param {BufferResolvable} attachment File to send + * @param {string} [name='file.jpg'] Name and extension of the file + * @param {StringResolvable} [content] Text for the message + * @param {MessageOptions} [options] Options for the message * @returns {Promise} */ sendFile(attachment, name, content, options = {}) { @@ -140,7 +140,7 @@ class TextBasedChannel { * Send a code block to this channel * @param {string} lang Language for the code block * @param {StringResolvable} content Content of the code block - * @param {MessageOptions} [options] The options to provide + * @param {MessageOptions} [options] Options for the message * @returns {Promise} */ sendCode(lang, content, options = {}) { @@ -150,7 +150,7 @@ class TextBasedChannel { /** * Gets a single message from this channel, regardless of it being cached or not. * This is only available when using a bot account. - * @param {string} messageID The ID of the message to get + * @param {string} messageID ID of the message to get * @returns {Promise} * @example * // get message @@ -178,7 +178,7 @@ class TextBasedChannel { /** * Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects. - * @param {ChannelLogsQueryOptions} [options={}] The query parameters to pass in + * @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in * @returns {Promise>} * @example * // get messages diff --git a/typings b/typings index 9b503a119..c8b3f8b89 160000 --- a/typings +++ b/typings @@ -1 +1 @@ -Subproject commit 9b503a119c10c6873c8fd8cc65576f0992da5967 +Subproject commit c8b3f8b8931d1318f1143ca26574ae1f9b4c5aa2