mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-23 00:57:13 +00:00
commit
3d786ee4bb
@ -20,6 +20,14 @@
|
||||
work with media groups lists
|
||||
* Fix `parseMode` of `InputTextMessageContent`
|
||||
|
||||
### 0.10.2
|
||||
|
||||
* 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`
|
||||
* Fix `replyMarkup` in `InlineQueryResultArticle`
|
||||
|
||||
## 0.9.0
|
||||
|
||||
* Old extension `OkHttpClient.Builder#useWith` now deprecated and must be replaced by the same in
|
||||
|
@ -1,4 +1,4 @@
|
||||
project.version = "0.10.1"
|
||||
project.version = "0.10.2"
|
||||
project.group = "com.github.insanusmokrassar"
|
||||
|
||||
buildscript {
|
||||
|
@ -19,11 +19,19 @@ fun Identifier.toChatId(): ChatId = ChatId(this)
|
||||
|
||||
@Serializable(ChatIdentifierSerializer::class)
|
||||
data class Username(
|
||||
val username: String
|
||||
private val baseUsername: String
|
||||
) : ChatIdentifier() {
|
||||
init {
|
||||
if (!username.startsWith("@")) {
|
||||
throw IllegalArgumentException("Username must starts with `@`")
|
||||
@Transient
|
||||
val username: String = if (!baseUsername.startsWith("@")) {
|
||||
"@$baseUsername"
|
||||
} else {
|
||||
baseUsername
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return super.equals(other) || when (other) {
|
||||
is String -> super.equals("@$other")
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ class InlineQueryResultArticle(
|
||||
@SerialName(inputMessageContentField)
|
||||
override val inputMessageContent: InputMessageContent,
|
||||
@SerialName(replyMarkupField)
|
||||
@Optional
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@SerialName(urlField)
|
||||
@Optional
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user