From f3f4e7ef7368fdce7fe84fd0ec5f8ae825a8e3c8 Mon Sep 17 00:00:00 2001 From: Justin Oro Date: Mon, 31 Aug 2026 10:51:10 -0700 Subject: [PATCH] Add release date to info card title from IsThereAnyDeal --- index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index efbb3e0..612bf22 100644 --- a/index.js +++ b/index.js @@ -254,6 +254,17 @@ async function fetchShops() { return res.json(); } +function formatReleaseDate(releaseDate) { + if (!releaseDate) return null; + const parts = releaseDate.split("-"); + if (parts.length !== 3) return null; + const year = parseInt(parts[0], 10); + const month = parseInt(parts[1], 10); + const day = parseInt(parts[2], 10); + if (!year || !month || !day) return null; + return day + " " + MONTH_NAMES[month - 1].slice(0, 3) + " " + year; +} + function toItadDateTime(date) { return date.toISOString().split(".")[0] + "+00:00"; } @@ -773,8 +784,11 @@ async function handleInfo(message, query) { priceLine = "unavailable"; } + const releaseDate = formatReleaseDate(info.releaseDate); + const title = releaseDate ? match.title + " (" + releaseDate + ")" : match.title; + const embed = new EmbedBuilder() - .setTitle(match.title) + .setTitle(title) .addFields( { name: "Price", value: priceLine, inline: true }, { name: "Platform(s)", value: platforms, inline: true }