Allow Message#edit to accept a RichEmbed and fixed RichEmbed#file's type (#1829)

This commit is contained in:
SpaceEEC
2017-08-25 19:50:01 +02:00
committed by Crawl
parent 1fe201ae90
commit 56fe70266e
2 changed files with 4 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
const Mentions = require('./MessageMentions'); const Mentions = require('./MessageMentions');
const Attachment = require('./MessageAttachment'); const Attachment = require('./MessageAttachment');
const Embed = require('./MessageEmbed'); const Embed = require('./MessageEmbed');
const RichEmbed = require('./RichEmbed');
const MessageReaction = require('./MessageReaction'); const MessageReaction = require('./MessageReaction');
const ReactionCollector = require('./ReactionCollector'); const ReactionCollector = require('./ReactionCollector');
const Util = require('../util/Util'); const Util = require('../util/Util');
@@ -365,7 +366,7 @@ class Message {
/** /**
* Edit the content of the message. * Edit the content of the message.
* @param {StringResolvable} [content] The new content for the message * @param {StringResolvable} [content] The new content for the message
* @param {MessageEditOptions} [options] The options to provide * @param {MessageEditOptions|RichEmbed} [options] The options to provide
* @returns {Promise<Message>} * @returns {Promise<Message>}
* @example * @example
* // Update the content of a message * // Update the content of a message
@@ -380,6 +381,7 @@ class Message {
} else if (!options) { } else if (!options) {
options = {}; options = {};
} }
if (options instanceof RichEmbed) options = { embed: options };
return this.client.rest.methods.updateMessage(this, content, options); return this.client.rest.methods.updateMessage(this, content, options);
} }

View File

@@ -69,7 +69,7 @@ class RichEmbed {
/** /**
* File to upload alongside this Embed * File to upload alongside this Embed
* @type {string} * @type {FileOptions|string|Attachment}
*/ */
this.file = data.file; this.file = data.file;
} }