Add commands for searching and initiating private chats with users (ref #7)

This commit is contained in:
Tulir Asokan
2017-11-25 14:08:06 +02:00
parent 3b42b17bb7
commit ae71433743
7 changed files with 155 additions and 32 deletions
+7 -3
View File
@@ -70,7 +70,7 @@ class TelegramUser {
}
}
async updateInfo(telegramPOV, user, { updateAvatar } = {}) {
async updateInfo(telegramPOV, user, { updateAvatar = false } = {}) {
let changed = false
if (this.firstName !== user.first_name) {
this.firstName = user.first_name
@@ -115,10 +115,14 @@ class TelegramUser {
return this.intent.client.credentials.userId
}
getFirstAndLastName() {
return [this.firstName, this.lastName].filter(s => !!s)
.join(" ")
}
getDisplayName() {
if (this.firstName || this.lastName) {
return [this.firstName, this.lastName].filter(s => !!s)
.join(" ")
return this.getFirstAndLastName()
} else if (this.username) {
return this.username
} else if (this.phoneNumber) {