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

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