Skip to content

Commit b8d4ed5

Browse files
committed
Fix issue with blank name in /stats list
1 parent 6d54c86 commit b8d4ed5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>clockvapor.telegram.markov-telegram-bot</groupId>
99
<artifactId>markov-telegram-bot</artifactId>
10-
<version>0.2.1</version>
10+
<version>0.2.2</version>
1111

1212
<properties>
1313
<kotlin.version>1.3.21</kotlin.version>

src/main/kotlin/clockvapor/telegram/markov/MarkovTelegramBot.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ class MarkovTelegramBot(private val token: String, private val dataPath: String)
280280
val chatMember = response.first?.body()?.result
281281
if (chatMember != null) {
282282
val mostDistinguishingWords = scoreMostDistinguishingWords(wordCounts, universe).keys.take(5)
283-
"${chatMember.user.displayName}\n" +
283+
"${chatMember.user.displayName.takeIf { it.isNotBlank() }
284+
?: chatMember.user.username?.takeIf { it.isNotBlank() }
285+
?: "User ID: $userId"}\n" +
284286
mostDistinguishingWords.mapIndexed { i, word -> "${i + 1}. $word" }.joinToString("\n")
285287
} else null
286288
}.filter { it.isNotBlank() }.joinToString("\n\n")

0 commit comments

Comments
 (0)