Merge branch 'main' into patch-1

This commit is contained in:
DaviDev 2024-09-08 18:22:25 -03:00 committed by GitHub
commit d87303d9f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 11 deletions

View file

@ -109,12 +109,11 @@ function formatPhone(phone) {
.filter(([_, key]) => formattedPhone[key])
.map(([label, key]) => `<b>${label}:</b> <code>${formattedPhone[key]}</code>`)
.join("\n\n");
const deviceNURL = <a href=`${formattedPhone.url}`>${formattedPhone.name}</a>
const deviceUrl = `<b>GSMArena page:</b> ${formattedPhone.url}`;
const deviceImage = phone.picture ? `<b>Device Image</b>: ${phone.picture}` : '';
return `<b>${deviceNURL}</b>\n\n${attributes}\n\n${deviceImage}`;
return `<b>\n\nName: </b><code>${formattedPhone.name}</code>\n\n${attributes}\n\n${deviceImage}\n\n${deviceUrl}`;
}
async function fetchHtml(url) {
@ -232,7 +231,7 @@ module.exports = (bot) => {
if (phoneDetails.name) {
const message = formatPhone(phoneDetails);
ctx.editMessageText(`<b><a href="tg://user?id=${userId}">${userName}</a>, there are the details of your device: </b>` + message, { parse_mode: 'HTML', disable_web_page_preview: false });
ctx.editMessageText(`<b><a href="tg://user?id=${userId}">${userName}</a>, there are the details of your device:</b>` + message, { parse_mode: 'HTML', disable_web_page_preview: false });
} else {
ctx.reply("Error fetching phone details.", { reply_with_message_id: ctx.message.message_id });
}

View file

@ -4,9 +4,13 @@ const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(is
async function getUserInfo(ctx) {
const Strings = getStrings(ctx.from.language_code);
let lastName = ctx.from.last_name;
if (lastName === undefined) {
lastName = " ";
}
userInfo = Strings.userInfo
.replace('{userName}', `${ctx.from.first_name} ${ctx.from.last_name}` || Strings.unKnown)
.replace('{userName}', `${ctx.from.first_name} ${lastName}` || Strings.unKnown)
.replace('{userId}', ctx.from.id || Strings.unKnown)
.replace('{userHandle}', ctx.from.username ? `@${ctx.from.username}` : Strings.varNone)
.replace('{userPremium}', ctx.from.is_premium ? Strings.varYes : Strings.varNo)