mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-16 13:49:26 +00:00
Merge branch '5.1.0' into feature/replace_can_send_media_messages_field
This commit is contained in:
@@ -261,6 +261,19 @@ const val iconColorField = "icon_color"
|
||||
const val requestContactField = "request_contact"
|
||||
const val requestLocationField = "request_location"
|
||||
const val requestPollField = "request_poll"
|
||||
const val requestUserField = "request_user"
|
||||
const val requestChatField = "request_chat"
|
||||
const val requestIdField = "request_id"
|
||||
|
||||
const val userIsBotField = "user_is_bot"
|
||||
const val userIsPremiumField = "user_is_premium"
|
||||
const val chatIsChannelField = "chat_is_channel"
|
||||
const val chatIsForumField = "chat_is_forum"
|
||||
const val chatHasUsernameField = "chat_has_username"
|
||||
const val chatIsCreatedField = "chat_is_created"
|
||||
const val userAdministratorRightsField = "user_administrator_rights"
|
||||
const val botAdministratorRightsField = "bot_administrator_rights"
|
||||
const val botIsMemberField = "bot_is_member"
|
||||
|
||||
const val fileNameField = "file_name"
|
||||
const val mimeTypeField = "mime_type"
|
||||
@@ -381,6 +394,7 @@ const val latitudeField = "latitude"
|
||||
const val longitudeField = "longitude"
|
||||
const val headingField = "heading"
|
||||
const val fromField = "from"
|
||||
const val userChatIdField = "user_chat_id"
|
||||
const val userField = "user"
|
||||
const val dateField = "date"
|
||||
const val chatField = "chat"
|
||||
|
@@ -94,6 +94,42 @@ data class RequestPollKeyboardButton(
|
||||
val requestPoll: KeyboardButtonPollType
|
||||
) : KeyboardButton
|
||||
|
||||
/**
|
||||
* Private chats only. When user will tap on this button, he will be asked for the chat with [requestChat] options. You
|
||||
* will be able to catch this [ChatId] in updates and data using
|
||||
* [dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onUserShared] in case you are using Behaviour
|
||||
* Builder OR with [dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter.messagesFlow]
|
||||
* and [kotlinx.coroutines.flow.filterIsInstance].
|
||||
*
|
||||
* In case you will use [dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onUserShared] it is
|
||||
* recommended to use [kotlinx.coroutines.flow.Flow] [kotlinx.coroutines.flow.filter] with checking of incoming
|
||||
* [dev.inmo.tgbotapi.types.request.UserShared.requestId]
|
||||
*/
|
||||
@Serializable
|
||||
data class RequestUserKeyboardButton(
|
||||
override val text: String,
|
||||
@SerialName(requestUserField)
|
||||
val requestUser: KeyboardButtonRequestUser
|
||||
) : KeyboardButton
|
||||
|
||||
/**
|
||||
* Private chats only. When user will tap on this button, he will be asked for the chat with [requestChat] options. You
|
||||
* will be able to catch this [ChatId] in updates and data using
|
||||
* [dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onChatShared] in case you are using Behaviour
|
||||
* Builder OR with [dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter.messagesFlow]
|
||||
* and [kotlinx.coroutines.flow.filterIsInstance].
|
||||
*
|
||||
* In case you will use [dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onChatShared] it is
|
||||
* recommended to use [kotlinx.coroutines.flow.Flow] [kotlinx.coroutines.flow.filter] with checking of incoming
|
||||
* [dev.inmo.tgbotapi.types.request.ChatShared.requestId]
|
||||
*/
|
||||
@Serializable
|
||||
data class RequestChatKeyboardButton(
|
||||
override val text: String,
|
||||
@SerialName(requestChatField)
|
||||
val requestChat: KeyboardButtonRequestChat
|
||||
) : KeyboardButton
|
||||
|
||||
@RiskFeature
|
||||
object KeyboardButtonSerializer : KSerializer<KeyboardButton> {
|
||||
private val internalSerializer = JsonElement.serializer()
|
||||
@@ -124,6 +160,20 @@ object KeyboardButtonSerializer : KSerializer<KeyboardButton> {
|
||||
asJson[requestPollField] ?.jsonObject ?: buildJsonObject { }
|
||||
)
|
||||
)
|
||||
asJson is JsonObject && asJson[requestUserField] != null -> RequestUserKeyboardButton(
|
||||
asJson[textField]!!.jsonPrimitive.content,
|
||||
nonstrictJsonFormat.decodeFromJsonElement(
|
||||
KeyboardButtonRequestUser.serializer(),
|
||||
asJson[requestUserField] ?.jsonObject ?: buildJsonObject { }
|
||||
)
|
||||
)
|
||||
asJson is JsonObject && asJson[requestChatField] != null -> RequestChatKeyboardButton(
|
||||
asJson[textField]!!.jsonPrimitive.content,
|
||||
nonstrictJsonFormat.decodeFromJsonElement(
|
||||
KeyboardButtonRequestChat.serializer(),
|
||||
asJson[requestChatField] ?.jsonObject ?: buildJsonObject { }
|
||||
)
|
||||
)
|
||||
else -> UnknownKeyboardButton(
|
||||
when (asJson) {
|
||||
is JsonObject -> asJson[textField]!!.jsonPrimitive.content
|
||||
@@ -142,6 +192,8 @@ object KeyboardButtonSerializer : KSerializer<KeyboardButton> {
|
||||
is WebAppKeyboardButton -> WebAppKeyboardButton.serializer().serialize(encoder, value)
|
||||
is RequestPollKeyboardButton -> RequestPollKeyboardButton.serializer().serialize(encoder, value)
|
||||
is SimpleKeyboardButton -> encoder.encodeString(value.text)
|
||||
is RequestUserKeyboardButton -> RequestUserKeyboardButton.serializer().serialize(encoder, value)
|
||||
is RequestChatKeyboardButton -> RequestChatKeyboardButton.serializer().serialize(encoder, value)
|
||||
is UnknownKeyboardButton -> JsonElement.serializer().serialize(encoder, nonstrictJsonFormat.parseToJsonElement(value.raw))
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,78 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.botAdministratorRightsField
|
||||
import dev.inmo.tgbotapi.types.botIsMemberField
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.chatHasUsernameField
|
||||
import dev.inmo.tgbotapi.types.chatIsChannelField
|
||||
import dev.inmo.tgbotapi.types.chatIsCreatedField
|
||||
import dev.inmo.tgbotapi.types.chatIsForumField
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.requestIdField
|
||||
import dev.inmo.tgbotapi.types.userAdministratorRightsField
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see Channel
|
||||
* @see Group
|
||||
*/
|
||||
@Serializable
|
||||
data class KeyboardButtonRequestChat(
|
||||
@SerialName(requestIdField)
|
||||
val requestId: RequestId,
|
||||
@SerialName(chatIsChannelField)
|
||||
val isChannel: Boolean? = null,
|
||||
@SerialName(chatIsForumField)
|
||||
val isForum: Boolean? = null,
|
||||
@SerialName(chatHasUsernameField)
|
||||
val isPublic: Boolean? = null,
|
||||
@SerialName(chatIsCreatedField)
|
||||
val isOwnedBy: Boolean? = null,
|
||||
@SerialName(userAdministratorRightsField)
|
||||
val userRightsInChat: ChatAdministratorRights? = null,
|
||||
@SerialName(botAdministratorRightsField)
|
||||
val botRightsInChat: ChatAdministratorRights? = null,
|
||||
@SerialName(botIsMemberField)
|
||||
val botIsMember: Boolean? = null
|
||||
) {
|
||||
companion object {
|
||||
fun Channel(
|
||||
requestId: RequestId,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRights? = null,
|
||||
botRightsInChat: ChatAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = KeyboardButtonRequestChat(
|
||||
requestId = requestId,
|
||||
isChannel = true,
|
||||
isForum = null,
|
||||
isPublic = isPublic,
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
)
|
||||
|
||||
fun Group(
|
||||
requestId: RequestId,
|
||||
isForum: Boolean? = null,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRights? = null,
|
||||
botRightsInChat: ChatAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = KeyboardButtonRequestChat(
|
||||
requestId = requestId,
|
||||
isChannel = false,
|
||||
isForum = isForum,
|
||||
isPublic = isPublic,
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,89 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.requestIdField
|
||||
import dev.inmo.tgbotapi.types.userIsBotField
|
||||
import dev.inmo.tgbotapi.types.userIsPremiumField
|
||||
import kotlinx.serialization.EncodeDefault
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Serializer
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
@Serializable(KeyboardButtonRequestUser.Companion::class)
|
||||
sealed interface KeyboardButtonRequestUser {
|
||||
val requestId: RequestId
|
||||
val isBot: Boolean?
|
||||
|
||||
@Serializable
|
||||
data class Any(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId
|
||||
) : KeyboardButtonRequestUser {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
override val isBot: Boolean? = null
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class Common(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId,
|
||||
@SerialName(userIsPremiumField)
|
||||
val isPremium: Boolean? = null
|
||||
) : KeyboardButtonRequestUser {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
override val isBot: Boolean = false
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class Bot(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId
|
||||
) : KeyboardButtonRequestUser {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
override val isBot: Boolean = true
|
||||
}
|
||||
|
||||
@Serializer(KeyboardButtonRequestUser::class)
|
||||
companion object : KSerializer<KeyboardButtonRequestUser> {
|
||||
@Serializable
|
||||
private data class Surrogate(
|
||||
@SerialName(requestIdField)
|
||||
val requestId: RequestId,
|
||||
@SerialName(userIsBotField)
|
||||
val userIsBot: Boolean? = null,
|
||||
@SerialName(userIsPremiumField)
|
||||
val userIsPremium: Boolean? = null
|
||||
)
|
||||
private val realSerializer = Surrogate.serializer()
|
||||
|
||||
override val descriptor: SerialDescriptor = realSerializer.descriptor
|
||||
|
||||
override fun deserialize(decoder: Decoder): KeyboardButtonRequestUser {
|
||||
val surrogate = realSerializer.deserialize(decoder)
|
||||
|
||||
return when (surrogate.userIsBot) {
|
||||
true -> Bot(surrogate.requestId)
|
||||
false -> Common(surrogate.requestId, surrogate.userIsPremium)
|
||||
null -> Any(surrogate.requestId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: KeyboardButtonRequestUser) {
|
||||
realSerializer.serialize(
|
||||
encoder,
|
||||
Surrogate(
|
||||
value.requestId,
|
||||
value.isBot,
|
||||
(value as? Common) ?.isPremium
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,6 +2,8 @@ package dev.inmo.tgbotapi.types.buttons.reply
|
||||
|
||||
import dev.inmo.tgbotapi.types.buttons.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
|
||||
|
||||
@@ -67,3 +69,161 @@ inline fun webAppReplyButton(
|
||||
text: String,
|
||||
url: String
|
||||
) = webAppReplyButton(text, WebAppInfo(url))
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestUserReplyButton(
|
||||
text: String,
|
||||
requestUser: KeyboardButtonRequestUser
|
||||
) = RequestUserKeyboardButton(
|
||||
text,
|
||||
requestUser
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Bot]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestBotReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
) = requestUserReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Bot(requestId)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Common]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestUserReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null
|
||||
) = requestUserReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Common(requestId, premiumUser)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Any]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestUserOrBotReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
) = requestUserReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Any(requestId)
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestChatReplyButton(
|
||||
text: String,
|
||||
requestChat: KeyboardButtonRequestChat
|
||||
) = RequestChatKeyboardButton(
|
||||
text,
|
||||
requestChat
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton] with [KeyboardButtonRequestChat]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestChatReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
isChannel: Boolean? = null,
|
||||
isForum: Boolean? = null,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRights? = null,
|
||||
botRightsInChat: ChatAdministratorRights? = null,
|
||||
botIsMember: Boolean = false
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat(
|
||||
requestId = requestId,
|
||||
isChannel = isChannel,
|
||||
isForum = isForum,
|
||||
isPublic = isPublic,
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton] with [KeyboardButtonRequestChat.Channel]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestChannelReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRights? = null,
|
||||
botRightsInChat: ChatAdministratorRights? = null,
|
||||
botIsMember: Boolean = false
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat.Channel(
|
||||
requestId = requestId,
|
||||
isPublic = isPublic,
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton] with [KeyboardButtonRequestChat.Group]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestChannelReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
isForum: Boolean? = null,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRights? = null,
|
||||
botRightsInChat: ChatAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat.Group(
|
||||
requestId = requestId,
|
||||
isForum = isForum,
|
||||
isPublic = isPublic,
|
||||
isOwnedBy = isOwnedBy,
|
||||
userRightsInChat = userRightsInChat,
|
||||
botRightsInChat = botRightsInChat,
|
||||
botIsMember = botIsMember
|
||||
)
|
||||
)
|
||||
|
@@ -15,6 +15,8 @@ data class ChatJoinRequest(
|
||||
val chat: PublicChat,
|
||||
@SerialName(fromField)
|
||||
override val from: User,
|
||||
@SerialName(userChatIdField)
|
||||
val userChatId: UserId,
|
||||
@SerialName(dateField)
|
||||
val date: TelegramDate,
|
||||
@SerialName(inviteLinkField)
|
||||
|
@@ -29,6 +29,8 @@ import dev.inmo.tgbotapi.types.passport.PassportData
|
||||
import dev.inmo.tgbotapi.types.payments.Invoice
|
||||
import dev.inmo.tgbotapi.types.payments.SuccessfulPayment
|
||||
import dev.inmo.tgbotapi.types.polls.Poll
|
||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||
import dev.inmo.tgbotapi.types.request.UserShared
|
||||
import dev.inmo.tgbotapi.types.venue.Venue
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -93,6 +95,9 @@ internal data class RawMessage(
|
||||
private val dice: Dice? = null,
|
||||
private val successful_payment: SuccessfulPayment? = null,
|
||||
|
||||
private val user_shared: UserShared? = null,
|
||||
private val chat_shared: ChatShared? = null,
|
||||
|
||||
// Voice Chat Service Messages
|
||||
private val video_chat_scheduled: VideoChatScheduled? = null,
|
||||
private val video_chat_started: VideoChatStarted? = null,
|
||||
@@ -249,6 +254,8 @@ internal data class RawMessage(
|
||||
successful_payment != null -> SuccessfulPaymentEvent(successful_payment)
|
||||
connected_website != null -> UserLoggedIn(connected_website)
|
||||
web_app_data != null -> web_app_data
|
||||
user_shared != null -> user_shared
|
||||
chat_shared != null -> chat_shared
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,17 @@
|
||||
package dev.inmo.tgbotapi.types.request
|
||||
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.chatIdField
|
||||
import dev.inmo.tgbotapi.types.requestIdField
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ChatShared(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId,
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatId
|
||||
) : ChatSharedRequest
|
@@ -0,0 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.request
|
||||
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateEvent
|
||||
|
||||
sealed interface ChatSharedRequest : RequestResponse, PrivateEvent {
|
||||
val chatId: ChatIdentifier
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package dev.inmo.tgbotapi.types.request
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
import kotlin.random.Random
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class RequestId(
|
||||
val float: Int
|
||||
) {
|
||||
companion object {
|
||||
fun random() = RequestId(Random.nextInt())
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package dev.inmo.tgbotapi.types.request
|
||||
|
||||
sealed interface RequestResponse {
|
||||
val requestId: RequestId
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package dev.inmo.tgbotapi.types.request
|
||||
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.requestIdField
|
||||
import dev.inmo.tgbotapi.types.userIdField
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class UserShared(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId,
|
||||
@SerialName(userIdField)
|
||||
val userId: UserId
|
||||
) : ChatSharedRequest {
|
||||
override val chatId: ChatId
|
||||
get() = userId
|
||||
}
|
Reference in New Issue
Block a user