mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
update user shared to users shared
This commit is contained in:
parent
c025a027c6
commit
fc183bfd2f
@ -19,7 +19,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||
import dev.inmo.tgbotapi.types.request.UserShared
|
||||
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
@ -202,7 +202,7 @@ suspend fun BehaviourContext.waitChatSharedRequest(
|
||||
suspend fun BehaviourContext.waitUserShared(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEvents<UserShared>(initRequest, errorFactory)
|
||||
) = waitEvents<UsersShared>(initRequest, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitChatShared(
|
||||
initRequest: Request<*>? = null,
|
||||
|
@ -19,7 +19,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||
import dev.inmo.tgbotapi.types.request.UserShared
|
||||
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
@ -196,7 +196,7 @@ suspend fun BehaviourContext.waitChatSharedRequestEventsMessages(
|
||||
suspend fun BehaviourContext.waitUserSharedEventsMessages(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEventsMessages<UserShared>(initRequest, errorFactory)
|
||||
) = waitEventsMessages<UsersShared>(initRequest, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitChatSharedEventsMessages(
|
||||
initRequest: Request<*>? = null,
|
||||
|
@ -25,7 +25,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||
import dev.inmo.tgbotapi.types.request.UserShared
|
||||
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
|
||||
internal suspend inline fun <BC : BehaviourContext, reified T : ChatEvent> BC.onEvent(
|
||||
@ -776,10 +776,10 @@ suspend fun <BC : BehaviourContext> BC.onChatSharedRequest(
|
||||
* data
|
||||
*/
|
||||
suspend fun <BC : BehaviourContext> BC.onUserShared(
|
||||
initialFilter: SimpleFilter<PrivateEventMessage<UserShared>>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<UserShared>, Update>? = MessageFilterByChat,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<UserShared>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<UserShared>>
|
||||
initialFilter: SimpleFilter<PrivateEventMessage<UsersShared>>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<UsersShared>, Update>? = MessageFilterByChat,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<UsersShared>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<UsersShared>>
|
||||
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||
|
||||
|
||||
|
@ -175,6 +175,8 @@ val keywordsInStickerLimit = 0 .. 20
|
||||
|
||||
val stickerKeywordLengthLimit = 0 .. 64
|
||||
|
||||
val keyboardButtonRequestUserLimit = 1 .. 10
|
||||
|
||||
val forwardMessagesLimit = 1 .. 100
|
||||
val copyMessagesLimit = forwardMessagesLimit
|
||||
val deleteMessagesLimit = forwardMessagesLimit
|
||||
@ -245,6 +247,7 @@ const val slowModeDelayField = "slow_mode_delay"
|
||||
const val maskPositionField = "mask_position"
|
||||
const val phoneNumberField = "phone_number"
|
||||
const val userIdField = "user_id"
|
||||
const val userIdsField = "user_ids"
|
||||
const val onlyIfBannedField = "only_if_banned"
|
||||
const val containsMasksField = "contains_masks"
|
||||
const val resultIdField = "result_id"
|
||||
@ -331,8 +334,10 @@ const val requestContactField = "request_contact"
|
||||
const val requestLocationField = "request_location"
|
||||
const val requestPollField = "request_poll"
|
||||
const val requestUserField = "request_user"
|
||||
const val requestUsersField = "request_users"
|
||||
const val requestChatField = "request_chat"
|
||||
const val requestIdField = "request_id"
|
||||
const val maxQuantityField = "max_quantity"
|
||||
|
||||
const val userIsBotField = "user_is_bot"
|
||||
const val userIsPremiumField = "user_is_premium"
|
||||
|
@ -103,13 +103,13 @@ data class RequestPollKeyboardButton(
|
||||
*
|
||||
* 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]
|
||||
* [dev.inmo.tgbotapi.types.request.UsersShared.requestId]
|
||||
*/
|
||||
@Serializable
|
||||
data class RequestUserKeyboardButton(
|
||||
override val text: String,
|
||||
@SerialName(requestUserField)
|
||||
val requestUser: KeyboardButtonRequestUser
|
||||
@SerialName(requestUsersField)
|
||||
val requestUsers: KeyboardButtonRequestUsers
|
||||
) : KeyboardButton
|
||||
|
||||
/**
|
||||
@ -160,11 +160,11 @@ object KeyboardButtonSerializer : KSerializer<KeyboardButton> {
|
||||
asJson[requestPollField] ?.jsonObject ?: buildJsonObject { }
|
||||
)
|
||||
)
|
||||
asJson is JsonObject && asJson[requestUserField] != null -> RequestUserKeyboardButton(
|
||||
asJson is JsonObject && asJson[requestUsersField] != null -> RequestUserKeyboardButton(
|
||||
asJson[textField]!!.jsonPrimitive.content,
|
||||
nonstrictJsonFormat.decodeFromJsonElement(
|
||||
KeyboardButtonRequestUser.serializer(),
|
||||
asJson[requestUserField] ?.jsonObject ?: buildJsonObject { }
|
||||
KeyboardButtonRequestUsers.serializer(),
|
||||
asJson[requestUsersField] ?.jsonObject ?: buildJsonObject { }
|
||||
)
|
||||
)
|
||||
asJson is JsonObject && asJson[requestChatField] != null -> RequestChatKeyboardButton(
|
||||
|
@ -1,9 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
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 dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||
import kotlinx.serialization.EncodeDefault
|
||||
import kotlinx.serialization.KSerializer
|
||||
@ -14,17 +12,20 @@ import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
@Serializable(KeyboardButtonRequestUser.Companion::class)
|
||||
@Serializable(KeyboardButtonRequestUsers.Companion::class)
|
||||
@ClassCastsIncluded
|
||||
sealed interface KeyboardButtonRequestUser {
|
||||
sealed interface KeyboardButtonRequestUsers {
|
||||
val requestId: RequestId
|
||||
val isBot: Boolean?
|
||||
val maxCount: Int
|
||||
|
||||
@Serializable
|
||||
data class Any(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId
|
||||
) : KeyboardButtonRequestUser {
|
||||
override val requestId: RequestId,
|
||||
@SerialName(maxQuantityField)
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
) : KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
override val isBot: Boolean? = null
|
||||
@ -35,8 +36,10 @@ sealed interface KeyboardButtonRequestUser {
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId,
|
||||
@SerialName(userIsPremiumField)
|
||||
val isPremium: Boolean? = null
|
||||
) : KeyboardButtonRequestUser {
|
||||
val isPremium: Boolean? = null,
|
||||
@SerialName(maxQuantityField)
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
) : KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
override val isBot: Boolean = false
|
||||
@ -45,15 +48,17 @@ sealed interface KeyboardButtonRequestUser {
|
||||
@Serializable
|
||||
data class Bot(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId
|
||||
) : KeyboardButtonRequestUser {
|
||||
override val requestId: RequestId,
|
||||
@SerialName(maxQuantityField)
|
||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
) : KeyboardButtonRequestUsers {
|
||||
@SerialName(userIsBotField)
|
||||
@EncodeDefault
|
||||
override val isBot: Boolean = true
|
||||
}
|
||||
|
||||
@Serializer(KeyboardButtonRequestUser::class)
|
||||
companion object : KSerializer<KeyboardButtonRequestUser> {
|
||||
@Serializer(KeyboardButtonRequestUsers::class)
|
||||
companion object : KSerializer<KeyboardButtonRequestUsers> {
|
||||
@Serializable
|
||||
private data class Surrogate(
|
||||
@SerialName(requestIdField)
|
||||
@ -61,31 +66,37 @@ sealed interface KeyboardButtonRequestUser {
|
||||
@SerialName(userIsBotField)
|
||||
val userIsBot: Boolean? = null,
|
||||
@SerialName(userIsPremiumField)
|
||||
val userIsPremium: Boolean? = null
|
||||
val userIsPremium: Boolean? = null,
|
||||
@SerialName(maxQuantityField)
|
||||
val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||
)
|
||||
private val realSerializer = Surrogate.serializer()
|
||||
|
||||
override val descriptor: SerialDescriptor = realSerializer.descriptor
|
||||
|
||||
override fun deserialize(decoder: Decoder): KeyboardButtonRequestUser {
|
||||
override fun deserialize(decoder: Decoder): KeyboardButtonRequestUsers {
|
||||
val surrogate = realSerializer.deserialize(decoder)
|
||||
|
||||
return when (surrogate.userIsBot) {
|
||||
true -> Bot(surrogate.requestId)
|
||||
false -> Common(surrogate.requestId, surrogate.userIsPremium)
|
||||
null -> Any(surrogate.requestId)
|
||||
true -> Bot(surrogate.requestId, surrogate.maxCount)
|
||||
false -> Common(surrogate.requestId, surrogate.userIsPremium, surrogate.maxCount)
|
||||
null -> Any(surrogate.requestId, surrogate.maxCount)
|
||||
}
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: KeyboardButtonRequestUser) {
|
||||
override fun serialize(encoder: Encoder, value: KeyboardButtonRequestUsers) {
|
||||
realSerializer.serialize(
|
||||
encoder,
|
||||
Surrogate(
|
||||
value.requestId,
|
||||
value.isBot,
|
||||
(value as? Common) ?.isPremium
|
||||
(value as? Common) ?.isPremium,
|
||||
value.maxCount
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("KeyboardButtonRequestUsers", "dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers"))
|
||||
typealias KeyboardButtonRequestUser = KeyboardButtonRequestUsers
|
@ -57,25 +57,25 @@ inline fun webAppReplyButton(
|
||||
*/
|
||||
inline fun requestUserReplyButton(
|
||||
text: String,
|
||||
requestUser: KeyboardButtonRequestUser
|
||||
requestUser: KeyboardButtonRequestUsers
|
||||
) = RequestUserKeyboardButton(
|
||||
text,
|
||||
requestUser
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Bot]
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot]
|
||||
*/
|
||||
inline fun requestBotReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
) = requestUserReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Bot(requestId)
|
||||
KeyboardButtonRequestUsers.Bot(requestId)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Common]
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Common]
|
||||
*/
|
||||
inline fun requestUserReplyButton(
|
||||
text: String,
|
||||
@ -83,18 +83,18 @@ inline fun requestUserReplyButton(
|
||||
premiumUser: Boolean? = null
|
||||
) = requestUserReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Common(requestId, premiumUser)
|
||||
KeyboardButtonRequestUsers.Common(requestId, premiumUser)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Any]
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Any]
|
||||
*/
|
||||
inline fun requestUserOrBotReplyButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
) = requestUserReplyButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Any(requestId)
|
||||
KeyboardButtonRequestUsers.Any(requestId)
|
||||
)
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ 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.request.UsersShared
|
||||
import dev.inmo.tgbotapi.types.stories.Story
|
||||
import dev.inmo.tgbotapi.types.venue.Venue
|
||||
import kotlinx.serialization.SerialName
|
||||
@ -97,7 +97,7 @@ internal data class RawMessage(
|
||||
private val dice: Dice? = null,
|
||||
private val successful_payment: SuccessfulPayment? = null,
|
||||
|
||||
private val user_shared: UserShared? = null,
|
||||
private val users_shared: UsersShared? = null,
|
||||
private val chat_shared: ChatShared? = null,
|
||||
|
||||
// Voice Chat Service Messages
|
||||
@ -266,7 +266,7 @@ 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
|
||||
users_shared != null -> users_shared
|
||||
chat_shared != null -> chat_shared
|
||||
else -> null
|
||||
}
|
||||
|
@ -1,19 +1,22 @@
|
||||
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 dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class UserShared(
|
||||
data class UsersShared(
|
||||
@SerialName(requestIdField)
|
||||
override val requestId: RequestId,
|
||||
@SerialName(userIdField)
|
||||
val userId: UserId
|
||||
@SerialName(userIdsField)
|
||||
val userIds: List<UserId>
|
||||
) : ChatSharedRequest {
|
||||
val userId: UserId
|
||||
get() = userIds.first()
|
||||
constructor(
|
||||
requestId: RequestId,
|
||||
userId: UserId
|
||||
) : this(requestId, listOf(userId))
|
||||
override val chatId: ChatId
|
||||
get() = userId
|
||||
}
|
@ -102,7 +102,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.URLInlineKeyboardBu
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.UnknownInlineKeyboardButton
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.WebAppInlineKeyboardButton
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUser
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.buttons.ReplyForce
|
||||
import dev.inmo.tgbotapi.types.buttons.ReplyKeyboardMarkup
|
||||
@ -420,7 +420,7 @@ import dev.inmo.tgbotapi.types.reactions.Reaction
|
||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||
import dev.inmo.tgbotapi.types.request.RequestResponse
|
||||
import dev.inmo.tgbotapi.types.request.UserShared
|
||||
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||
import dev.inmo.tgbotapi.types.update.CallbackQueryUpdate
|
||||
import dev.inmo.tgbotapi.types.update.ChannelPostUpdate
|
||||
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||
@ -1735,32 +1735,32 @@ public inline fun <T>
|
||||
InlineKeyboardButton.ifWebAppInlineKeyboardButton(block: (WebAppInlineKeyboardButton) -> T): T?
|
||||
= webAppInlineKeyboardButtonOrNull() ?.let(block)
|
||||
|
||||
public inline fun KeyboardButtonRequestUser.anyOrNull(): KeyboardButtonRequestUser.Any? = this as?
|
||||
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUser.Any
|
||||
public inline fun KeyboardButtonRequestUsers.anyOrNull(): KeyboardButtonRequestUsers.Any? = this as?
|
||||
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Any
|
||||
|
||||
public inline fun KeyboardButtonRequestUser.anyOrThrow(): KeyboardButtonRequestUser.Any = this as
|
||||
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUser.Any
|
||||
public inline fun KeyboardButtonRequestUsers.anyOrThrow(): KeyboardButtonRequestUsers.Any = this as
|
||||
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Any
|
||||
|
||||
public inline fun <T> KeyboardButtonRequestUser.ifAny(block: (KeyboardButtonRequestUser.Any) -> T):
|
||||
public inline fun <T> KeyboardButtonRequestUsers.ifAny(block: (KeyboardButtonRequestUsers.Any) -> T):
|
||||
T? = anyOrNull() ?.let(block)
|
||||
|
||||
public inline fun KeyboardButtonRequestUser.botOrNull(): KeyboardButtonRequestUser.Bot? = this as?
|
||||
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUser.Bot
|
||||
public inline fun KeyboardButtonRequestUsers.botOrNull(): KeyboardButtonRequestUsers.Bot? = this as?
|
||||
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Bot
|
||||
|
||||
public inline fun KeyboardButtonRequestUser.botOrThrow(): KeyboardButtonRequestUser.Bot = this as
|
||||
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUser.Bot
|
||||
public inline fun KeyboardButtonRequestUsers.botOrThrow(): KeyboardButtonRequestUsers.Bot = this as
|
||||
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Bot
|
||||
|
||||
public inline fun <T> KeyboardButtonRequestUser.ifBot(block: (KeyboardButtonRequestUser.Bot) -> T):
|
||||
public inline fun <T> KeyboardButtonRequestUsers.ifBot(block: (KeyboardButtonRequestUsers.Bot) -> T):
|
||||
T? = botOrNull() ?.let(block)
|
||||
|
||||
public inline fun KeyboardButtonRequestUser.commonOrNull(): KeyboardButtonRequestUser.Common? = this
|
||||
as? dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUser.Common
|
||||
public inline fun KeyboardButtonRequestUsers.commonOrNull(): KeyboardButtonRequestUsers.Common? = this
|
||||
as? dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Common
|
||||
|
||||
public inline fun KeyboardButtonRequestUser.commonOrThrow(): KeyboardButtonRequestUser.Common = this
|
||||
as dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUser.Common
|
||||
public inline fun KeyboardButtonRequestUsers.commonOrThrow(): KeyboardButtonRequestUsers.Common = this
|
||||
as dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Common
|
||||
|
||||
public inline fun <T>
|
||||
KeyboardButtonRequestUser.ifCommon(block: (KeyboardButtonRequestUser.Common) -> T): T? =
|
||||
KeyboardButtonRequestUsers.ifCommon(block: (KeyboardButtonRequestUsers.Common) -> T): T? =
|
||||
commonOrNull() ?.let(block)
|
||||
|
||||
public inline fun KeyboardMarkup.inlineKeyboardMarkupOrNull(): InlineKeyboardMarkup? = this as?
|
||||
@ -2972,13 +2972,13 @@ public inline fun ChatEvent.chatSharedRequestOrThrow(): ChatSharedRequest = this
|
||||
public inline fun <T> ChatEvent.ifChatSharedRequest(block: (ChatSharedRequest) -> T): T? =
|
||||
chatSharedRequestOrNull() ?.let(block)
|
||||
|
||||
public inline fun ChatEvent.userSharedOrNull(): UserShared? = this as?
|
||||
dev.inmo.tgbotapi.types.request.UserShared
|
||||
public inline fun ChatEvent.userSharedOrNull(): UsersShared? = this as?
|
||||
dev.inmo.tgbotapi.types.request.UsersShared
|
||||
|
||||
public inline fun ChatEvent.userSharedOrThrow(): UserShared = this as
|
||||
dev.inmo.tgbotapi.types.request.UserShared
|
||||
public inline fun ChatEvent.userSharedOrThrow(): UsersShared = this as
|
||||
dev.inmo.tgbotapi.types.request.UsersShared
|
||||
|
||||
public inline fun <T> ChatEvent.ifUserShared(block: (UserShared) -> T): T? = userSharedOrNull()
|
||||
public inline fun <T> ChatEvent.ifUserShared(block: (UsersShared) -> T): T? = userSharedOrNull()
|
||||
?.let(block)
|
||||
|
||||
public inline fun ForwardInfo.byAnonymousOrNull(): ForwardInfo.ByAnonymous? = this as?
|
||||
@ -4564,13 +4564,13 @@ public inline fun RequestResponse.chatSharedRequestOrThrow(): ChatSharedRequest
|
||||
public inline fun <T> RequestResponse.ifChatSharedRequest(block: (ChatSharedRequest) -> T): T? =
|
||||
chatSharedRequestOrNull() ?.let(block)
|
||||
|
||||
public inline fun RequestResponse.userSharedOrNull(): UserShared? = this as?
|
||||
dev.inmo.tgbotapi.types.request.UserShared
|
||||
public inline fun RequestResponse.userSharedOrNull(): UsersShared? = this as?
|
||||
dev.inmo.tgbotapi.types.request.UsersShared
|
||||
|
||||
public inline fun RequestResponse.userSharedOrThrow(): UserShared = this as
|
||||
dev.inmo.tgbotapi.types.request.UserShared
|
||||
public inline fun RequestResponse.userSharedOrThrow(): UsersShared = this as
|
||||
dev.inmo.tgbotapi.types.request.UsersShared
|
||||
|
||||
public inline fun <T> RequestResponse.ifUserShared(block: (UserShared) -> T): T? =
|
||||
public inline fun <T> RequestResponse.ifUserShared(block: (UsersShared) -> T): T? =
|
||||
userSharedOrNull() ?.let(block)
|
||||
|
||||
public inline fun Update.callbackQueryUpdateOrNull(): CallbackQueryUpdate? = this as?
|
||||
|
@ -139,7 +139,7 @@ inline fun ReplyKeyboardRowBuilder.webAppButton(
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestUserButton(
|
||||
text: String,
|
||||
requestUser: KeyboardButtonRequestUser
|
||||
requestUser: KeyboardButtonRequestUsers
|
||||
) = add(
|
||||
requestUserReplyButton(
|
||||
text,
|
||||
@ -148,7 +148,7 @@ inline fun ReplyKeyboardRowBuilder.requestUserButton(
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Bot]
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
@ -158,11 +158,11 @@ inline fun ReplyKeyboardRowBuilder.requestBotButton(
|
||||
requestId: RequestId
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Bot(requestId)
|
||||
KeyboardButtonRequestUsers.Bot(requestId)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Common]
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Common]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
@ -173,11 +173,11 @@ inline fun ReplyKeyboardRowBuilder.requestUserButton(
|
||||
premiumUser: Boolean? = null
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Common(requestId, premiumUser)
|
||||
KeyboardButtonRequestUsers.Common(requestId, premiumUser)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Any]
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Any]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
@ -187,7 +187,7 @@ inline fun ReplyKeyboardRowBuilder.requestUserOrBotButton(
|
||||
requestId: RequestId
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Any(requestId)
|
||||
KeyboardButtonRequestUsers.Any(requestId)
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user