mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
User as PrivateChat
This commit is contained in:
parent
761e08afc6
commit
a17af67f83
@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
### 0.20.1
|
### 0.20.1
|
||||||
|
|
||||||
|
* `User` now implement `PrivateChat`
|
||||||
|
* `TextMentionMessageEntity` now accept `PrivateChat` instead of `User` in main constructor
|
||||||
|
* `TextMentionMessageEntity` now contains not user, but contains `PrivateChat`
|
||||||
|
|
||||||
## 0.19.0 ImplicitReflection removing
|
## 0.19.0 ImplicitReflection removing
|
||||||
|
|
||||||
* Total rework of serialization for requests. Now all `SimpleRequest` children have:
|
* Total rework of serialization for requests. Now all `SimpleRequest` children have:
|
||||||
|
@ -1,14 +1,23 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionMarkdown
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionMarkdown
|
||||||
|
|
||||||
class TextMentionMessageEntity(
|
class TextMentionMessageEntity(
|
||||||
override val offset: Int,
|
override val offset: Int,
|
||||||
override val length: Int,
|
override val length: Int,
|
||||||
override val sourceString: String,
|
override val sourceString: String,
|
||||||
val user: User
|
val privateChat: PrivateChat
|
||||||
) : MessageEntity {
|
) : MessageEntity {
|
||||||
override val asMarkdownSource: String = sourceString.mentionMarkdown(user.id)
|
@Deprecated("Deprecated due to the fact that there is more common constructor")
|
||||||
override val asHtmlSource: String = sourceString.mentionMarkdown(user.id)
|
constructor(
|
||||||
|
offset: Int,
|
||||||
|
length: Int,
|
||||||
|
sourceString: String,
|
||||||
|
user: User
|
||||||
|
) : this(offset, length, sourceString, user as PrivateChat)
|
||||||
|
|
||||||
|
override val asMarkdownSource: String = sourceString.mentionMarkdown(privateChat.id)
|
||||||
|
override val asHtmlSource: String = sourceString.mentionMarkdown(privateChat.id)
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types
|
package com.github.insanusmokrassar.TelegramBotAPI.types
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class User(
|
data class User(
|
||||||
val id: ChatId,
|
override val id: ChatId,
|
||||||
@SerialName(isBotField)
|
@SerialName(isBotField)
|
||||||
val isBot: Boolean = false,
|
val isBot: Boolean = false,
|
||||||
@SerialName(firstNameField)
|
@SerialName(firstNameField)
|
||||||
val firstName: String,
|
override val firstName: String,
|
||||||
@SerialName(lastNameField)
|
@SerialName(lastNameField)
|
||||||
val lastName: String? = null,
|
override val lastName: String = "",
|
||||||
@SerialName(usernameField)
|
@SerialName(usernameField)
|
||||||
val username: Username? = null,
|
override val username: Username? = null,
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
val languageCode: String? = null
|
val languageCode: String? = null
|
||||||
)
|
) : PrivateChat
|
||||||
|
Loading…
Reference in New Issue
Block a user