mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
fixed MessageEmbed#timestamp and changed attachFile to attachFiles (#1670)
* fixed MessageEmbed#timestamp and changed attachFile to attachFiles as well as a few doc changes * Embed#files shouldn't be a nested array
This commit is contained in:
@@ -44,11 +44,11 @@ class MessageEmbed {
|
||||
* The timestamp of this embed
|
||||
* @type {?number}
|
||||
*/
|
||||
this.timestamp = new Date(data.timestamp);
|
||||
this.timestamp = data.timestamp ? new Date(data.timestamp).getTime() : null;
|
||||
|
||||
/**
|
||||
* The fields of this embed
|
||||
* @type {?Object[]}
|
||||
* @type {Object[]}
|
||||
* @property {string} name The name of this field
|
||||
* @property {string} value The value of this field
|
||||
* @property {boolean} inline If this field will be displayed inline
|
||||
@@ -133,11 +133,11 @@ class MessageEmbed {
|
||||
|
||||
/**
|
||||
* The date this embed was created
|
||||
* @type {Date}
|
||||
* @type {?Date}
|
||||
* @readonly
|
||||
*/
|
||||
get createdAt() {
|
||||
return !isNaN(this.timestamp) ? this.timestamp : null;
|
||||
return this.timestamp ? new Date(this.timestamp) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,12 +178,12 @@ class MessageEmbed {
|
||||
/**
|
||||
* Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when
|
||||
* setting an embed image or author/footer icons. Only one file may be attached.
|
||||
* @param {FileOptions|string} file Local path or URL to the file to attach, or valid FileOptions for a file to attach
|
||||
* @param {Array<FileOptions|string>} files Files to attach
|
||||
* @returns {MessageEmbed} This embed
|
||||
*/
|
||||
attachFile(file) {
|
||||
if (this.file) throw new RangeError('EMBED_FILE_LIMIT');
|
||||
this.file = file;
|
||||
attachFiles(files) {
|
||||
if (this.files) this.files = this.files.concat(files);
|
||||
else this.files = files;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ class MessageEmbed {
|
||||
timestamp: this.timestamp,
|
||||
color: this.color,
|
||||
fields: this.fields,
|
||||
file: this.file,
|
||||
files: this.files,
|
||||
thumbnail: this.thumbnail,
|
||||
image: this.image,
|
||||
author: this.author ? {
|
||||
|
||||
Reference in New Issue
Block a user