From 2f1997a4d0931fc890e351af03b1b80848255efe Mon Sep 17 00:00:00 2001 From: GiovaniFZ Date: Sun, 8 Sep 2024 14:00:48 -0300 Subject: [PATCH] fix: Let last name empty if username doesn't have one --- commands/info.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/info.js b/commands/info.js index 1d57198..fc320ca 100644 --- a/commands/info.js +++ b/commands/info.js @@ -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)