mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
backport: RichEmbed#attachFiles
This commit is contained in:
@@ -72,6 +72,12 @@ class RichEmbed {
|
||||
* @type {FileOptions|string|Attachment}
|
||||
*/
|
||||
this.file = data.file;
|
||||
|
||||
/**
|
||||
* The files to upload alongside this Embed
|
||||
* @type {Array<FileOptions|string|Attachment>}
|
||||
*/
|
||||
this.files = [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,6 +222,18 @@ class RichEmbed {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the files to upload alongside the embed. A file can be accessed via `attachment://fileName.extension` when
|
||||
* setting an embed image or author/footer icons. Multiple files can be attached.
|
||||
* @param {Array<FileOptions|string|Attachment>} files Files to attach
|
||||
* @returns {RichEmbed}
|
||||
*/
|
||||
attachFiles(files) {
|
||||
files = files.map(file => file instanceof Attachment ? file.file : file);
|
||||
this.files = this.files.concat(files);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the embed object to be processed.
|
||||
* @returns {Object} The raw data of this embed
|
||||
|
||||
@@ -125,9 +125,15 @@ class TextBasedChannel {
|
||||
}
|
||||
options.reply = reply;
|
||||
|
||||
if (options.embed && options.embed.file) {
|
||||
if (options.files) options.files.push(options.embed.file);
|
||||
else options.files = [options.embed.file];
|
||||
if (options.embed) {
|
||||
if (options.embed.file) {
|
||||
if (options.files) options.files.push(options.embed.file);
|
||||
else options.files = [options.embed.file];
|
||||
}
|
||||
if (options.embed.files) {
|
||||
if (options.files) options.files = options.files.concat(options.embed.files);
|
||||
else options.files = options.embed.files;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.file) {
|
||||
|
||||
Reference in New Issue
Block a user