This small snippet shows how you can use the Discord timestamps in your own bot. It send an example with all the different formats when you send !timestamp
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// get information about the current time
const now = new Date();
var unixTime = Math.round(new Date(`${now}`).getTime() / 1000);
/* This is how you use them:
`` Short date and time (Default): 18 June 2021 15:57
`` Short date and time: 18 June 2021 15:57
`` Long date time: Friday, 18 June 2021 15:57
`` Short date: 18/06/2021
`` Long date: 18 June 2021
`` Short time: 15:57
`` Long time: 15:57:14
`` Relative time: 7 months ago
*/
// and this is how they look inside Discord:
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embeds: [
{
type: 'rich',
title: `The timestamps will look like this:`,
description: `No flag: \nFlag \`f\`: \nFlag \`F\`: \nFlag \`d\`: \nFlag \`D\`: \nFlag \`t\`: \nFlag \`T\`: \nFlag \`R\`: `,
color: 0x00ffff,
},
],
});