feat(RichEmbed): add timestamp support for setTimestamp (#3061)

This commit is contained in:
SpaceEEC
2019-02-12 10:15:37 +01:00
committed by GitHub
parent 1618829cc6
commit 49e8bd9edd
2 changed files with 4 additions and 3 deletions

View File

@@ -140,10 +140,11 @@ class RichEmbed {
/** /**
* Sets the timestamp of this embed. * Sets the timestamp of this embed.
* @param {Date} [timestamp=new Date()] The timestamp * @param {Date|number} [timestamp=Date.now()] The timestamp or date
* @returns {RichEmbed} This embed * @returns {RichEmbed} This embed
*/ */
setTimestamp(timestamp = new Date()) { setTimestamp(timestamp = Date.now()) {
if (timestamp instanceof Date) timestamp = timestamp.getTime();
this.timestamp = timestamp; this.timestamp = timestamp;
return this; return this;
} }

2
typings/index.d.ts vendored
View File

@@ -1030,7 +1030,7 @@ declare module 'discord.js' {
public setFooter(text: StringResolvable, icon?: string): this; public setFooter(text: StringResolvable, icon?: string): this;
public setImage(url: string): this; public setImage(url: string): this;
public setThumbnail(url: string): this; public setThumbnail(url: string): this;
public setTimestamp(timestamp?: Date): this; public setTimestamp(timestamp?: Date | number): this;
public setTitle(title: StringResolvable): this; public setTitle(title: StringResolvable): this;
public setURL(url: string): this; public setURL(url: string): this;
} }