Skip to content

Commit

Permalink
Fix issue with blank name in /stats list
Browse files Browse the repository at this point in the history
  • Loading branch information
ClockVapor committed Mar 30, 2019
1 parent 6d54c86 commit b8d4ed5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>clockvapor.telegram.markov-telegram-bot</groupId>
<artifactId>markov-telegram-bot</artifactId>
<version>0.2.1</version>
<version>0.2.2</version>

<properties>
<kotlin.version>1.3.21</kotlin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ class MarkovTelegramBot(private val token: String, private val dataPath: String)
val chatMember = response.first?.body()?.result
if (chatMember != null) {
val mostDistinguishingWords = scoreMostDistinguishingWords(wordCounts, universe).keys.take(5)
"${chatMember.user.displayName}\n" +
"${chatMember.user.displayName.takeIf { it.isNotBlank() }
?: chatMember.user.username?.takeIf { it.isNotBlank() }
?: "User ID: $userId"}\n" +
mostDistinguishingWords.mapIndexed { i, word -> "${i + 1}. $word" }.joinToString("\n")
} else null
}.filter { it.isNotBlank() }.joinToString("\n\n")
Expand Down

0 comments on commit b8d4ed5

Please sign in to comment.