mirror of
https://github.com/danbulant/discord.js
synced 2026-07-07 12:11:11 +00:00
feat(MessageEmbed): allow setTimestamp to take a timestamp (#2875)
* feat: allow MessageEmbed#setTimestamp to take a timestamp * fix the dumb i did
This commit is contained in:
parent
27d2ce7baf
commit
1fe36087d4
2 changed files with 5 additions and 4 deletions
|
|
@ -267,11 +267,12 @@ class MessageEmbed {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the timestamp of this embed.
|
* 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}
|
* @returns {MessageEmbed}
|
||||||
*/
|
*/
|
||||||
setTimestamp(timestamp = new Date()) {
|
setTimestamp(timestamp = Date.now()) {
|
||||||
this.timestamp = timestamp.getTime();
|
if (timestamp instanceof Date) timestamp = timestamp.getTime();
|
||||||
|
this.timestamp = timestamp;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
|
|
@ -741,7 +741,7 @@ declare module 'discord.js' {
|
||||||
public setFooter(text: StringResolvable, iconURL?: string): this;
|
public setFooter(text: StringResolvable, iconURL?: 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;
|
||||||
public toJSON(): object;
|
public toJSON(): object;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue