From f6581ff3bea5d4f021f2477223ac996063375654 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 18 Feb 2019 12:56:50 +0800 Subject: [PATCH] replace all usernames which was as strings by Username class usage --- CHANGELOG.md | 1 + .../com/github/insanusmokrassar/TelegramBotAPI/types/User.kt | 2 +- .../TelegramBotAPI/types/chat/ChannelChat.kt | 5 ++--- .../TelegramBotAPI/types/chat/PrivateChat.kt | 5 ++--- .../insanusmokrassar/TelegramBotAPI/types/chat/RawChat.kt | 5 ++--- .../TelegramBotAPI/types/chat/SupergroupChat.kt | 5 ++--- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da7e0d6a38..49acd27eb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ work with media groups lists * Fixes in `Username` * Now you can create username object using string which is not starting with `@` * Now `Username` correctly comparing with strings, which are not starting with `@` +* Now most part of usernames in library have type `Username` ## 0.9.0 diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt index 4e40b14e93..c824ff3d3c 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt @@ -17,7 +17,7 @@ data class User( val lastName: String? = null, @SerialName(usernameField) @Optional - val username: String? = null, + val username: Username? = null, @SerialName(languageCodeField) @Optional private val languageCode: String? = null diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChannelChat.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChannelChat.kt index fb861ea9e4..244350736c 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChannelChat.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChannelChat.kt @@ -1,13 +1,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.chat -import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId -import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto +import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage data class ChannelChat( override val id: ChatId, override val title: String? = null, - val username: String? = null, + val username: Username? = null, val description: String? = null, override val inviteLink: String? = null, override val chatPhoto: ChatPhoto? = null, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/PrivateChat.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/PrivateChat.kt index 4d1fb7ca1e..f266426398 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/PrivateChat.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/PrivateChat.kt @@ -1,11 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.chat -import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId -import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto +import com.github.insanusmokrassar.TelegramBotAPI.types.* data class PrivateChat( override val id: ChatId, - val username: String? = null, + val username: Username? = null, val firstName: String? = null, val lastName: String? = null, override val chatPhoto: ChatPhoto? = null diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/RawChat.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/RawChat.kt index 442bb58653..f10eaf9957 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/RawChat.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/RawChat.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.chat -import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId -import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto +import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import kotlinx.serialization.* @@ -10,7 +9,7 @@ data class RawChat( override val id: ChatId, private val type: String, @Optional private val title: String? = null, - @Optional private val username: String? = null, + @Optional private val username: Username? = null, @Optional private val first_name: String? = null, @Optional private val last_name: String? = null, @Optional private val all_members_are_administrators: Boolean? = null, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/SupergroupChat.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/SupergroupChat.kt index f555efa613..3a1232e4fb 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/SupergroupChat.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/SupergroupChat.kt @@ -1,13 +1,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.chat -import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId -import com.github.insanusmokrassar.TelegramBotAPI.types.ChatPhoto +import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage data class SupergroupChat( override val id: ChatId, override val title: String? = null, - val username: String? = null, + val username: Username? = null, val description: String? = null, override val allMembersAreAdmins: Boolean, override val inviteLink: String? = null,