toowake

time.js (current Date and Time)

Apr 1st, 2023
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
  2.  
  3. module.exports = {
  4. data: new SlashCommandBuilder()
  5. .setName("time")
  6. .setDescription("the current time and date"),
  7.  
  8. async execute (interaction) {
  9.  
  10. const embed = new EmbedBuilder()
  11. .setTitle("Time")
  12. .addFields(
  13. {name: "Time:", value: `<t:${Math.floor((Date.now()) / 1000)}:T>`, inline: true},
  14. {name: "Date:", value: `<t:${Math.floor((Date.now()) / 1000)}:D>`, inline: true}
  15. )
  16.  
  17. return interaction.reply({
  18. embeds: [embed]
  19. })
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment