See the image this discord bot shows the time the message was sent as footer of embed. Like the next day it changes from today to yesterday like how can i make this?
I wanna do basically the same use the time as a footer.
Please help me
So there's a method in Discord.js's MessageEmbed class, its called .setTimestamp().
.setTimestamp allows you to add a timestamp on your embed footer. Here's an example:
const {
MessageEmbed
} = require('discord.js');
const exampleEmbed = new MessageEmbed()
.setTitle("Example")
.setTimestamp(); // This is what you need!
Read more about .setTimestamp here: https://discord.js.org/#/docs/main/stable/class/MessageEmbed?scrollTo=setTimestamp
If you want to set the exactly time and day you have to use :
var d = new Date,
dformat = [d.getMonth()+1,
d.getDate(),
d.getFullYear()].join('/')+' '+
[d.getHours(),
d.getMinutes(),
d.getSeconds()].join(':');
You have to set the d in the line you want!
If you want to add it in footer you do it like this :
.setFooter(d)