Merge branch 'indev' into indev-prism

This commit is contained in:
Amish Shah
2016-12-29 17:26:22 +00:00
10 changed files with 48 additions and 30 deletions

View File

@@ -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.

View File

@@ -17,8 +17,8 @@
</div>
# 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

View File

@@ -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",

View File

@@ -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,

View File

@@ -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; }

View File

@@ -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; }

View File

@@ -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
*/
/**

View File

@@ -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<MessageReaction>}
*/
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<Collection<string, User>>}
*/

View File

@@ -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<Message|Message[]>}
* @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<Message|Message[]>}
* @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<Message>}
*/
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<Message>}
*/
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<Message|Message[]>}
*/
sendCode(lang, content, options = {}) {
@@ -150,7 +150,7 @@ class TextBasedChannel {
/**
* 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>
* @param {string} messageID The ID of the message to get
* @param {string} messageID ID of the message to get
* @returns {Promise<Message>}
* @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<Collection<string, Message>>}
* @example
* // get messages

Submodule typings updated: 9b503a119c...c8b3f8b893