Skip to content

Commit 49e8bd9

Browse files
authored
feat(RichEmbed): add timestamp support for setTimestamp (#3061)
1 parent 1618829 commit 49e8bd9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/structures/RichEmbed.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,11 @@ class RichEmbed {
140140

141141
/**
142142
* Sets the timestamp of this embed.
143-
* @param {Date} [timestamp=new Date()] The timestamp
143+
* @param {Date|number} [timestamp=Date.now()] The timestamp or date
144144
* @returns {RichEmbed} This embed
145145
*/
146-
setTimestamp(timestamp = new Date()) {
146+
setTimestamp(timestamp = Date.now()) {
147+
if (timestamp instanceof Date) timestamp = timestamp.getTime();
147148
this.timestamp = timestamp;
148149
return this;
149150
}

typings/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ declare module 'discord.js' {
10301030
public setFooter(text: StringResolvable, icon?: string): this;
10311031
public setImage(url: string): this;
10321032
public setThumbnail(url: string): this;
1033-
public setTimestamp(timestamp?: Date): this;
1033+
public setTimestamp(timestamp?: Date | number): this;
10341034
public setTitle(title: StringResolvable): this;
10351035
public setURL(url: string): this;
10361036
}

0 commit comments

Comments
 (0)