diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index ea32508..ef8d938 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -1020,20 +1020,30 @@ async function processUrl(msg, url, spoiler = false, command = false) { } let platform = (await resolvePlatform(url)) ?? ""; - let color = PLATFORM_COLORS[platform.toLowerCase()]; - let platformName = normalizePlatform(platform); if (PATH_REGEX.twitter.test(urlObj.pathname)) { - const hostname = urlObj.hostname.replace(/^www\./, ""); - if (!TW_DOMAINS.includes(hostname)) logger.info("fedimbed", `Got new Twitter domain: ${urlObj.hostname}`); + let hostname = urlObj.hostname.replace(/^www\./, ""); + if (TW_DOMAINS.includes(hostname)) { + if (command === true) { + urlObj.hostname = "tw.c7.pm"; + url = urlObj.toString(); + hostname = "tw.c7.pm"; + platform = "Nitter"; + } + } else { + logger.info("fedimbed", `Got new Twitter domain: ${hostname}`); + } if (platform != "Nitter") return {}; if (platform == "Nitter" && command === false) { if (hostname != "tw.c7.pm" && hostname != "tw.counter-strike.gay") - logger.info("fedimbed", `Got new Nitter domain running fork: ${urlObj.hostname}`); + logger.info("fedimbed", `Got new Nitter domain running fork: ${hostname}`); return {}; } } + let color = PLATFORM_COLORS[platform.toLowerCase()]; + let platformName = normalizePlatform(platform); + const images = []; const videos = []; const audios = [];