presence: escape colons, add more verbose time stuff

This commit is contained in:
Cynthia Foxwell 2024-09-06 21:17:38 -06:00
parent 105805fb69
commit 37f550ac1e

View file

@ -172,9 +172,13 @@ presence.callback = async function (msg, line) {
if (activity.timestamps) {
if (activity.timestamps.start && !activity.timestamps.end) {
descLines.push(formatTime(Date.now() - activity.timestamps.start) + " elapsed");
descLines.push(formatTime(Date.now() - activity.timestamps.start).replaceAll(":", "\\:") + " elapsed");
descLines.push(
`-# <t:${Math.floor(activity.timestamps.start / 1000)}:R> \u2022 ${activity.timestamps.start}`
);
} else if (!activity.timestamps.start && activity.timestamps.end) {
descLines.push(formatTime(activity.timestamps.end - Date.now()) + " remaining");
descLines.push(formatTime(activity.timestamps.end - Date.now()).replaceAll(":", "\\:") + " remaining");
descLines.push(`-# <t:${Math.floor(activity.timestamps.end / 1000)}:R> \u2022 ${activity.timestamps.end}`);
} else if (activity.timestamps.start != null && activity.timestamps.end != null) {
const position = Date.now() - activity.timestamps.start;
const length = activity.timestamps.end - activity.timestamps.start;