I want the bot to send the total time, counting from where it started to where it stopped, I want it to look like this:
hours: h minutes: m seconds: s
const Discord = require('discord.js')
const moment = require('moment')
module.exports = {
name: "baterponto",
category: "Mod",
description: "Bata o seu ponto.",
run: async (client, interaction) => {
let terminar = new Discord.MessageActionRow().addComponents(
new Discord.MessageButton()
.setCustomId("terminar")
.setLabel("Finalizar")
.setStyle(4)
)
let p = interaction.user.username;
let embed = new Discord.MessageEmbed()
.setAuthor({ name: 'Ponto iniciado' })
.addFields({ name: 'Usuario:', value: `> ${p}`})
.addFields({ name: 'Iniciou:', value: `<t:${moment(interaction.creationTimestamp).unix()}>`})
.addFields({ name: `Finalizou:`, value: `> ...`})
const msg = await interaction.channel.send({embeds: [embed], components: [terminar]})
const collector = msg.createMessageComponentCollector()
collector.on('collect', async(collected) => {
if(collected.user.id != interaction.user.id) return collected.reply(
{ content: `:x: \`|\` **Somente a pessoa que executou o comando (\`${interaction.user.tag}\`) pode interagir com ele.**`, ephemeral: true }
);
if( collected.customId === "terminar" ) {
const terminou = new Discord.MessageEmbed()
.setAuthor({name:"Ponto encerrado"})
.addFields({name:`Usuario:`, value: `${p}`})
.addFields({name: `Iniciou:`, value: `<t:${moment(interaction.createdTimestamp).unix()}>`})
.addFields({name:`Finalizou:`, value: `<t:${moment(collected.createdTimestamp).unix()}>`})
msg.edit({
embeds: [terminou],
components: []
})
}
})
}
}