From a10ef8980e476d0ab1a5ba05e5ababa332f64768 Mon Sep 17 00:00:00 2001 From: lucmsilva651 Date: Sun, 8 Sep 2024 11:59:11 -0300 Subject: [PATCH] Put GSMArena page from device onto message (based on #9) --- commands/gsmarena.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/gsmarena.js b/commands/gsmarena.js index 2b751bb..28aa475 100644 --- a/commands/gsmarena.js +++ b/commands/gsmarena.js @@ -110,9 +110,11 @@ function formatPhone(phone) { .map(([label, key]) => `${label}: ${formattedPhone[key]}`) .join("\n\n"); + + const deviceUrl = `GSMArena page: ${formattedPhone.url}`; const deviceImage = phone.picture ? `Device Image: ${phone.picture}` : ''; - return `${formattedPhone.name}\n\n${attributes}\n\n${deviceImage}`; + return `\n\nName: ${formattedPhone.name}\n\n${attributes}\n\n${deviceImage}\n\n${deviceUrl}`; } async function fetchHtml(url) { @@ -230,7 +232,7 @@ module.exports = (bot) => { if (phoneDetails.name) { const message = formatPhone(phoneDetails); - ctx.editMessageText(`${userName}, there are the details of your device: ` + message, { parse_mode: 'HTML', disable_web_page_preview: false }); + ctx.editMessageText(`${userName}, there are the details of your device:` + message, { parse_mode: 'HTML', disable_web_page_preview: false }); } else { ctx.reply("Error fetching phone details.", { reply_with_message_id: ctx.message.message_id }); }