Skip to content

Commit

Permalink
feat(MessageEmbed): allow setTimestamp to take a timestamp (#2875)
Browse files Browse the repository at this point in the history
* feat: allow MessageEmbed#setTimestamp to take a timestamp

* fix the dumb i did
  • Loading branch information
Lewdcario authored and SpaceEEC committed Oct 10, 2018
1 parent 27d2ce7 commit 1fe3608
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/structures/MessageEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,12 @@ class MessageEmbed {

/**
* Sets the timestamp of this embed.
* @param {Date} [timestamp=current date] The timestamp
* @param {Date|number} [timestamp=Date.now()] The timestamp or date
* @returns {MessageEmbed}
*/
setTimestamp(timestamp = new Date()) {
this.timestamp = timestamp.getTime();
setTimestamp(timestamp = Date.now()) {
if (timestamp instanceof Date) timestamp = timestamp.getTime();
this.timestamp = timestamp;
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ declare module 'discord.js' {
public setFooter(text: StringResolvable, iconURL?: string): this;
public setImage(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 setURL(url: string): this;
public toJSON(): object;
Expand Down

0 comments on commit 1fe3608

Please sign in to comment.