mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
feat(RichEmbed): add timestamp support for setTimestamp (#3061)
This commit is contained in:
@@ -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
2
typings/index.d.ts
vendored
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user