Attempt at adding timestamps 💀

This commit is contained in:
Christopher Cookman 2024-05-19 18:32:00 -06:00
parent 66a454d46e
commit 6679ea55c6

View file

@ -1232,11 +1232,16 @@ discord.on("interactionCreate", async (interaction) => {
interaction.editReply({ content: "Failed to get outlook", ephemeral: true });
return;
}
// get date and expires headers, convert them to Date objects
date = new Date(res.headers.get("date"));
expires = new Date(res.headers.get("expires"));
// Returns image, send embed with image as attachment (we need to bypass discord cache)
res.buffer().then(async (buffer) => {
interaction.editReply({
embeds: [{
title: `${toTitleCase(type)} Outlook Day ${day + 1}`,
description: `Issued <t:${Math.floor(date.getTime() / 1000)}:R> <t:${Math.floor(date.getTime() / 1000)}:t>\nExpires <t:${Math.floor(expires.getTime() / 1000)}:R> <t:${Math.floor(expires.getTime() / 1000)}:t>`,
image: {
url: `attachment://${type}_${day}.png`
},