mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
Merge branch 'indev' into indev-prism
This commit is contained in:
@@ -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
|
||||||
Version 10's non-BC changes focus on cleaning up some inconsistencies that exist in previous versions.
|
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.
|
Upgrading from v9 should be quick and painless.
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
# Welcome!
|
# Welcome!
|
||||||
Welcome to the discord.js v10 documentation.
|
Welcome to the discord.js v11 documentation.
|
||||||
v10 is just a more consistent and stable iteration over v9, and contains loads of new and improved features, optimisations, and bug fixes.
|
v11 contains loads of new and improved features, optimisations, and bug fixes.
|
||||||
|
|
||||||
## About
|
## About
|
||||||
discord.js is a powerful node.js module that allows you to interact with the
|
discord.js is a powerful node.js module that allows you to interact with the
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discord.js",
|
"name": "discord.js",
|
||||||
"version": "10.0.1",
|
"version": "11.0.0",
|
||||||
"description": "A powerful library for interacting with the Discord API",
|
"description": "A powerful library for interacting with the Discord API",
|
||||||
"main": "./src/index",
|
"main": "./src/index",
|
||||||
"types": "./typings/index.d.ts",
|
"types": "./typings/index.d.ts",
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ class RESTMethods {
|
|||||||
if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);
|
if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);
|
||||||
|
|
||||||
if (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 = 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)) {
|
if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) {
|
||||||
@@ -59,7 +59,7 @@ class RESTMethods {
|
|||||||
if (split) content = splitMessage(content, typeof split === 'object' ? split : {});
|
if (split) content = splitMessage(content, typeof split === 'object' ? split : {});
|
||||||
}
|
}
|
||||||
|
|
||||||
const send = (chan) => {
|
const send = chan => {
|
||||||
if (content instanceof Array) {
|
if (content instanceof Array) {
|
||||||
const messages = [];
|
const messages = [];
|
||||||
(function sendChunk(list, index) {
|
(function sendChunk(list, index) {
|
||||||
@@ -87,9 +87,9 @@ class RESTMethods {
|
|||||||
|
|
||||||
updateMessage(message, content, { embed, code } = {}) {
|
updateMessage(message, content, { embed, code } = {}) {
|
||||||
content = this.client.resolver.resolveString(content);
|
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 = 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, {
|
return this.rest.makeRequest('patch', Constants.Endpoints.channelMessage(message.channel.id, message.id), true, {
|
||||||
content, embed,
|
content, embed,
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ class DMChannel extends Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||||
|
send() { return; }
|
||||||
sendMessage() { return; }
|
sendMessage() { return; }
|
||||||
sendTTSMessage() { return; }
|
|
||||||
sendEmbed() { return; }
|
sendEmbed() { return; }
|
||||||
sendFile() { return; }
|
sendFile() { return; }
|
||||||
sendCode() { return; }
|
sendCode() { return; }
|
||||||
|
|||||||
@@ -121,8 +121,8 @@ class GroupDMChannel extends Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||||
|
send() { return; }
|
||||||
sendMessage() { return; }
|
sendMessage() { return; }
|
||||||
sendTTSMessage() { return; }
|
|
||||||
sendEmbed() { return; }
|
sendEmbed() { return; }
|
||||||
sendFile() { return; }
|
sendFile() { return; }
|
||||||
sendCode() { return; }
|
sendCode() { return; }
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ class Message {
|
|||||||
* Options that can be passed into editMessage
|
* Options that can be passed into editMessage
|
||||||
* @typedef {Object} MessageEditOptions
|
* @typedef {Object} MessageEditOptions
|
||||||
* @property {Object} [embed] An embed to be added/edited
|
* @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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class MessageReaction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a user from this reaction.
|
* 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<MessageReaction>}
|
* @returns {Promise<MessageReaction>}
|
||||||
*/
|
*/
|
||||||
remove(user = this.message.client.user) {
|
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,
|
* Fetch all the users that gave this reaction. Resolves with a collection of users, mapped by their IDs.
|
||||||
* mapped by their IDs.
|
|
||||||
* @param {number} [limit=100] the maximum amount of users to fetch, defaults to 100
|
* @param {number} [limit=100] the maximum amount of users to fetch, defaults to 100
|
||||||
* @returns {Promise<Collection<string, User>>}
|
* @returns {Promise<Collection<string, User>>}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class TextBasedChannel {
|
|||||||
* @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here
|
* @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here
|
||||||
* should be replaced with plain-text
|
* should be replaced with plain-text
|
||||||
* @property {FileOptions|string} [file] A file to send with the message
|
* @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
|
* @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.
|
* 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
|
* Send a message to this channel
|
||||||
* @param {StringResolvable} [content] The content to send
|
* @param {StringResolvable} [content] Text for the message
|
||||||
* @param {MessageOptions} [options={}] The options to provide
|
* @param {MessageOptions} [options={}] Options for the message
|
||||||
* @returns {Promise<Message|Message[]>}
|
* @returns {Promise<Message|Message[]>}
|
||||||
* @example
|
* @example
|
||||||
* // send a message
|
* // send a message
|
||||||
@@ -94,8 +94,8 @@ class TextBasedChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to this channel
|
* Send a message to this channel
|
||||||
* @param {StringResolvable} content The content to send
|
* @param {StringResolvable} content Text for the message
|
||||||
* @param {MessageOptions} [options={}] The options to provide
|
* @param {MessageOptions} [options={}] Options for the message
|
||||||
* @returns {Promise<Message|Message[]>}
|
* @returns {Promise<Message|Message[]>}
|
||||||
* @example
|
* @example
|
||||||
* // send a message
|
* // send a message
|
||||||
@@ -109,9 +109,9 @@ class TextBasedChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send an embed to this channel
|
* Send an embed to this channel
|
||||||
* @param {RichEmbed|Object} embed The embed to send
|
* @param {RichEmbed|Object} embed Embed for the message
|
||||||
* @param {string} [content] Content to send
|
* @param {string} [content] Text for the message
|
||||||
* @param {MessageOptions} [options] The options to provide
|
* @param {MessageOptions} [options] Options for the message
|
||||||
* @returns {Promise<Message>}
|
* @returns {Promise<Message>}
|
||||||
*/
|
*/
|
||||||
sendEmbed(embed, content, options) {
|
sendEmbed(embed, content, options) {
|
||||||
@@ -126,10 +126,10 @@ class TextBasedChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a file to this channel
|
* Send a file to this channel
|
||||||
* @param {BufferResolvable} attachment The file to send
|
* @param {BufferResolvable} attachment File to send
|
||||||
* @param {string} [name='file.jpg'] The name and extension of the file
|
* @param {string} [name='file.jpg'] Name and extension of the file
|
||||||
* @param {StringResolvable} [content] Text message to send with the attachment
|
* @param {StringResolvable} [content] Text for the message
|
||||||
* @param {MessageOptions} [options] The options to provide
|
* @param {MessageOptions} [options] Options for the message
|
||||||
* @returns {Promise<Message>}
|
* @returns {Promise<Message>}
|
||||||
*/
|
*/
|
||||||
sendFile(attachment, name, content, options = {}) {
|
sendFile(attachment, name, content, options = {}) {
|
||||||
@@ -140,7 +140,7 @@ class TextBasedChannel {
|
|||||||
* Send a code block to this channel
|
* Send a code block to this channel
|
||||||
* @param {string} lang Language for the code block
|
* @param {string} lang Language for the code block
|
||||||
* @param {StringResolvable} content Content of 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<Message|Message[]>}
|
* @returns {Promise<Message|Message[]>}
|
||||||
*/
|
*/
|
||||||
sendCode(lang, content, options = {}) {
|
sendCode(lang, content, options = {}) {
|
||||||
@@ -150,7 +150,7 @@ class TextBasedChannel {
|
|||||||
/**
|
/**
|
||||||
* Gets a single message from this channel, regardless of it being cached or not.
|
* Gets a single message from this channel, regardless of it being cached or not.
|
||||||
* <warn>This is only available when using a bot account.</warn>
|
* <warn>This is only available when using a bot account.</warn>
|
||||||
* @param {string} messageID The ID of the message to get
|
* @param {string} messageID ID of the message to get
|
||||||
* @returns {Promise<Message>}
|
* @returns {Promise<Message>}
|
||||||
* @example
|
* @example
|
||||||
* // get message
|
* // 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.
|
* 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<Collection<string, Message>>}
|
* @returns {Promise<Collection<string, Message>>}
|
||||||
* @example
|
* @example
|
||||||
* // get messages
|
* // get messages
|
||||||
|
|||||||
2
typings
2
typings
Submodule typings updated: 9b503a119c...c8b3f8b893
Reference in New Issue
Block a user