Relative Timestamp inside of Embed showing wrong time

This one has me perplexed. I've deleted dist and rebuilt, I've also refreshed the client, but I can't for the life of me understand why it's giving the incorrect timestamp when it's sent as part of the embed. The message itself is output into console. If I copy the timestamp from that message <t:1750701118:R>. and put it through in a message myself, right after - it's correct, as I expect it. But in the embed itself - it says 55 years ago ? It's the exact same <t:xxx:R> value - why different :shrug:
import { ColorResolvable, GuildMember } from "discord.js";
import { DrpgColors, dateToEpoch } from "drpg-utils";
import { Events, Listener, ListenerOptions, MessageCommandDeniedPayload, UserError } from "@sapphire/framework";

import { Logger } from "drpg-logger";
import { embedField } from "../../lib/DRPG-Utils/EmbedField";

export class MessageCommandDenied extends Listener<typeof Events.MessageCommandDenied> {
public constructor(context: Listener.LoaderContext, options?: ListenerOptions) {
super(context, { ...options, event: Events.MessageCommandDenied });
}

public async run(error: UserError, { message }: MessageCommandDeniedPayload) {
console.log(error.identifier);
const embed = Logger.warn(error.message, error.identifier ?? "Command Denied");

if (error.identifier == "Maintenance Mode") embed.addFields(embedField("Started", `<t:${dateToEpoch(new Date())}>`));

if (error.identifier == "preconditionCooldown") {
embed.setTitle("⏳ Command Cooldown");
embed.setColor(DrpgColors.yellow as ColorResolvable);

const rawTimeRemaining = (error.context as { remaining: number }).remaining; //I know how ugly this is, pain is temporary.
const timeRemainingSeconds = Math.floor(rawTimeRemaining / 1000);

embed.setDescription(`${message.author} - You must wait before using \`${message.content}\` again.\nIt will be available in <t:${timeRemainingSeconds}:R>`);
}

return message.reply({ embeds: [embed] });
}
}
import { ColorResolvable, GuildMember } from "discord.js";
import { DrpgColors, dateToEpoch } from "drpg-utils";
import { Events, Listener, ListenerOptions, MessageCommandDeniedPayload, UserError } from "@sapphire/framework";

import { Logger } from "drpg-logger";
import { embedField } from "../../lib/DRPG-Utils/EmbedField";

export class MessageCommandDenied extends Listener<typeof Events.MessageCommandDenied> {
public constructor(context: Listener.LoaderContext, options?: ListenerOptions) {
super(context, { ...options, event: Events.MessageCommandDenied });
}

public async run(error: UserError, { message }: MessageCommandDeniedPayload) {
console.log(error.identifier);
const embed = Logger.warn(error.message, error.identifier ?? "Command Denied");

if (error.identifier == "Maintenance Mode") embed.addFields(embedField("Started", `<t:${dateToEpoch(new Date())}>`));

if (error.identifier == "preconditionCooldown") {
embed.setTitle("⏳ Command Cooldown");
embed.setColor(DrpgColors.yellow as ColorResolvable);

const rawTimeRemaining = (error.context as { remaining: number }).remaining; //I know how ugly this is, pain is temporary.
const timeRemainingSeconds = Math.floor(rawTimeRemaining / 1000);

embed.setDescription(`${message.author} - You must wait before using \`${message.content}\` again.\nIt will be available in <t:${timeRemainingSeconds}:R>`);
}

return message.reply({ embeds: [embed] });
}
}
(The same happens in my ChatInputRunCommandDenied and MessageCommandDenied - they are identical in showing 55 years ago, outputting the value to console, and that value being correct when manually entered. DJS 14.18.0 Sapphire 5.3.2
No description
2 Replies
Bejasc
BejascOP3mo ago
There must be something I'm not seeing... the Logger.Warn will print the default error.message e.g preconditionCooldown: There is a cooldown in effect for this message command. It'll be available <t:1750701822:R>. - the timestamp from this log, when I send it, is correct. But the timestamp that I'm getting in the rawTimeRemaining is 55 years ago
Favna
Favna3mo ago
55 years ago means you probably need to multiply it by 1000

Did you find this page helpful?