fix: Let last name empty if username doesn't have one
This commit is contained in:
parent
7070a0e51f
commit
2f1997a4d0
1 changed files with 5 additions and 1 deletions
|
@ -4,9 +4,13 @@ const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(is
|
||||||
|
|
||||||
async function getUserInfo(ctx) {
|
async function getUserInfo(ctx) {
|
||||||
const Strings = getStrings(ctx.from.language_code);
|
const Strings = getStrings(ctx.from.language_code);
|
||||||
|
let lastName = ctx.from.last_name;
|
||||||
|
if (lastName === undefined) {
|
||||||
|
lastName = " ";
|
||||||
|
}
|
||||||
|
|
||||||
userInfo = Strings.userInfo
|
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('{userId}', ctx.from.id || Strings.unKnown)
|
||||||
.replace('{userHandle}', ctx.from.username ? `@${ctx.from.username}` : Strings.varNone)
|
.replace('{userHandle}', ctx.from.username ? `@${ctx.from.username}` : Strings.varNone)
|
||||||
.replace('{userPremium}', ctx.from.is_premium ? Strings.varYes : Strings.varNo)
|
.replace('{userPremium}', ctx.from.is_premium ? Strings.varYes : Strings.varNo)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue