1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-09-19 17:16:08 +00:00

start implementation of superchannels

This commit is contained in:
InsanusMokrassar 2024-08-14 19:47:29 +06:00
parent f58a28d062
commit b469b1c789
12 changed files with 378 additions and 247 deletions

View File

@ -6,11 +6,23 @@ import dev.inmo.tgbotapi.types.chat.User
* Inheritors of this interface have some [User] as a source of data. For example, any [dev.inmo.tgbotapi.types.queries.callback.CallbackQuery] * Inheritors of this interface have some [User] as a source of data. For example, any [dev.inmo.tgbotapi.types.queries.callback.CallbackQuery]
* have [User] as the source of that query * have [User] as the source of that query
*/ */
interface FromUser : WithUser { interface OptionallyFromUser : OptionallyWithUser {
/** /**
* The source [User] of this type * The source [User] of this type
*/ */
val from: User val from: User?
override val user: User?
get() = from
}
/**
* Inheritors of this interface have some [User] as a source of data. For example, any [dev.inmo.tgbotapi.types.queries.callback.CallbackQuery]
* have [User] as the source of that query
*/
interface FromUser : OptionallyFromUser, WithUser {
/**
* The source [User] of this type
*/
override val from: User
override val user: User override val user: User
get() = from get() = from
} }

View File

@ -9,6 +9,14 @@ import dev.inmo.tgbotapi.types.chat.User
* @see FromUser * @see FromUser
*/ */
@ClassCastsIncluded(excludeRegex = ".*Impl") @ClassCastsIncluded(excludeRegex = ".*Impl")
interface WithUser { interface OptionallyWithUser {
val user: User val user: User?
}
/**
* All inheritors of this type have [User] in their data as one of the main data
*
* @see FromUser
*/
interface WithUser : OptionallyWithUser {
override val user: User
} }

View File

@ -10,6 +10,7 @@ value class RawChatId(
) { ) {
companion object { companion object {
val DefaultUserId = RawChatId(136817688L) // I do not know why, it is Telegram crutch val DefaultUserId = RawChatId(136817688L) // I do not know why, it is Telegram crutch
val FakeUserId = RawChatId(777000L) // Brought with Telegram Bot API 7.9 as backward compatibility value for from field
} }
override fun toString(): String { override fun toString(): String {

View File

@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.CommonBot import dev.inmo.tgbotapi.types.chat.CommonBot
import dev.inmo.tgbotapi.types.chat.PreviewChannelChat import dev.inmo.tgbotapi.types.chat.PreviewChannelChat
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.message.abstracts.* import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.types.message.content.MessageContent import dev.inmo.tgbotapi.types.message.content.MessageContent
data class ChannelContentMessageImpl<T: MessageContent>( data class ChannelContentMessageImpl<T: MessageContent>(
override val messageId: MessageId, override val messageId: MessageId,
override val from: User?,
override val chat: PreviewChannelChat, override val chat: PreviewChannelChat,
override val content: T, override val content: T,
override val date: DateTime, override val date: DateTime,
@ -25,6 +27,7 @@ data class ChannelContentMessageImpl<T: MessageContent>(
) : ChannelContentMessage<T> { ) : ChannelContentMessage<T> {
constructor( constructor(
messageId: MessageId, messageId: MessageId,
from: User?,
chat: PreviewChannelChat, chat: PreviewChannelChat,
content: T, content: T,
date: DateTime, date: DateTime,
@ -38,6 +41,6 @@ data class ChannelContentMessageImpl<T: MessageContent>(
mediaGroupId: MediaGroupId?, mediaGroupId: MediaGroupId?,
fromOffline: Boolean, fromOffline: Boolean,
) : this( ) : this(
messageId, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, authorSignature, mediaGroupId, fromOffline messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, authorSignature, mediaGroupId, fromOffline
) )
} }

View File

@ -37,6 +37,7 @@ import dev.inmo.tgbotapi.types.request.ChatShared
import dev.inmo.tgbotapi.types.request.UsersShared import dev.inmo.tgbotapi.types.request.UsersShared
import dev.inmo.tgbotapi.types.stories.Story import dev.inmo.tgbotapi.types.stories.Story
import dev.inmo.tgbotapi.types.venue.Venue import dev.inmo.tgbotapi.types.venue.Venue
import dev.inmo.tgbotapi.utils.isFakeTelegramUser
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlin.reflect.KClass import kotlin.reflect.KClass
@ -160,6 +161,7 @@ internal data class RawMessage(
private val giveaway_created: GiveawayCreated? = null, private val giveaway_created: GiveawayCreated? = null,
private val giveaway_completed: GiveawayPrivateResults? = null, private val giveaway_completed: GiveawayPrivateResults? = null,
) { ) {
private val checkedFrom = from ?.takeIf { !it.isFakeTelegramUser() }
private val content: MessageContent? by lazy { private val content: MessageContent? by lazy {
val adaptedCaptionEntities = caption ?.let { val adaptedCaptionEntities = caption ?.let {
(caption_entities ?: emptyList()).asTextSources(caption) (caption_entities ?: emptyList()).asTextSources(caption)
@ -298,14 +300,14 @@ internal data class RawMessage(
when (chat) { when (chat) {
is PreviewSupergroupChat -> CommonSupergroupEventMessage( is PreviewSupergroupChat -> CommonSupergroupEventMessage(
messageId, messageId,
from ?: error("Supergroup events are expected to contain 'from' field"), checkedFrom ?: from ?: error("Supergroup events are expected to contain 'from' field"),
chat, chat,
chatEvent as? SupergroupEvent ?: throwWrongChatEvent(SupergroupEvent::class, chatEvent), chatEvent as? SupergroupEvent ?: throwWrongChatEvent(SupergroupEvent::class, chatEvent),
date.asDate date.asDate
) )
is PreviewGroupChat -> CommonGroupEventMessage( is PreviewGroupChat -> CommonGroupEventMessage(
messageId, messageId,
from ?: error("Supergroup events are expected to contain 'from' field"), checkedFrom ?: from ?: error("Supergroup events are expected to contain 'from' field"),
chat, chat,
chatEvent as? GroupEvent ?: throwWrongChatEvent(GroupChat::class, chatEvent), chatEvent as? GroupEvent ?: throwWrongChatEvent(GroupChat::class, chatEvent),
date.asDate date.asDate
@ -337,6 +339,7 @@ internal data class RawMessage(
is PreviewPublicChat -> when (chat) { is PreviewPublicChat -> when (chat) {
is PreviewChannelChat -> ChannelContentMessageImpl( is PreviewChannelChat -> ChannelContentMessageImpl(
messageId = messageId, messageId = messageId,
from = checkedFrom ?: from,
chat = chat, chat = chat,
content = content, content = content,
date = date.asDate, date = date.asDate,
@ -396,7 +399,7 @@ internal data class RawMessage(
chat = actualForumChat, chat = actualForumChat,
messageId = messageId, messageId = messageId,
threadId = messageThreadId, threadId = messageThreadId,
from = from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"), from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate, date = date.asDate,
forwardOrigin = forward_origin, forwardOrigin = forward_origin,
editDate = edit_date ?.asDate, editDate = edit_date ?.asDate,
@ -465,7 +468,7 @@ internal data class RawMessage(
null -> CommonGroupContentMessageImpl( null -> CommonGroupContentMessageImpl(
chat = chat, chat = chat,
messageId = messageId, messageId = messageId,
from = from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"), from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate, date = date.asDate,
forwardOrigin = forward_origin, forwardOrigin = forward_origin,
editDate = edit_date ?.asDate, editDate = edit_date ?.asDate,
@ -534,7 +537,7 @@ internal data class RawMessage(
null -> CommonGroupContentMessageImpl( null -> CommonGroupContentMessageImpl(
chat = chat, chat = chat,
messageId = messageId, messageId = messageId,
from = from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"), from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate, date = date.asDate,
forwardOrigin = forward_origin, forwardOrigin = forward_origin,
editDate = edit_date ?.asDate, editDate = edit_date ?.asDate,
@ -552,7 +555,7 @@ internal data class RawMessage(
is PreviewPrivateChat -> if (business_connection_id == null) { is PreviewPrivateChat -> if (business_connection_id == null) {
PrivateContentMessageImpl( PrivateContentMessageImpl(
messageId = messageId, messageId = messageId,
from = from ?: error("Was detected common message, but owner (sender) of the message was not found"), from = checkedFrom ?: from ?: error("Was detected common message, but owner (sender) of the message was not found"),
chat = chat, chat = chat,
content = content, content = content,
date = date.asDate, date = date.asDate,
@ -569,7 +572,7 @@ internal data class RawMessage(
} else { } else {
BusinessContentMessageImpl( BusinessContentMessageImpl(
messageId = messageId, messageId = messageId,
from = from ?: error("Was detected common message, but owner (sender) of the message was not found"), from = checkedFrom ?: from ?: error("Was detected common message, but owner (sender) of the message was not found"),
chat = BusinessChatImpl( chat = BusinessChatImpl(
chat.id.toBusinessChatId(business_connection_id), chat.id.toBusinessChatId(business_connection_id),
chat chat
@ -594,7 +597,7 @@ internal data class RawMessage(
PassportMessage( PassportMessage(
messageId, messageId,
chat, chat,
from ?: error("For passport must be provided user, but got null"), checkedFrom ?: from ?: error("For passport must be provided user, but got null"),
date.asDate, date.asDate,
passport_data passport_data
) )

View File

@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.types.chat.ChannelChat
import dev.inmo.tgbotapi.types.chat.PreviewChannelChat import dev.inmo.tgbotapi.types.chat.PreviewChannelChat
import dev.inmo.tgbotapi.types.message.content.MessageContent import dev.inmo.tgbotapi.types.message.content.MessageContent
interface ChannelContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, SignedMessage, WithSenderChatMessage { interface ChannelContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, SignedMessage, WithSenderChatMessage, OptionallyFromUserMessage {
override val chat: PreviewChannelChat override val chat: PreviewChannelChat
override val senderChat: PreviewChannelChat override val senderChat: PreviewChannelChat
get() = chat get() = chat

View File

@ -1,5 +1,8 @@
package dev.inmo.tgbotapi.types.message.abstracts package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.abstracts.FromUser import dev.inmo.tgbotapi.abstracts.FromUser
import dev.inmo.tgbotapi.abstracts.OptionallyFromUser
interface FromUserMessage : FromUser, AccessibleMessage interface OptionallyFromUserMessage : OptionallyFromUser, AccessibleMessage
interface FromUserMessage : OptionallyFromUserMessage, FromUser

View File

@ -0,0 +1,14 @@
package dev.inmo.tgbotapi.utils
import dev.inmo.tgbotapi.types.RawChatId
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.chat.User
val TelegramFakeUser = CommonUser(
id = UserId(RawChatId.FakeUserId),
firstName = "Telegram"
)
fun User.isFakeTelegramUser() = id == TelegramFakeUser.id && firstName == TelegramFakeUser.firstName

View File

@ -17,6 +17,7 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
return when (sourceMessage) { return when (sourceMessage) {
is ChannelContentMessage -> ChannelContentMessageImpl( is ChannelContentMessage -> ChannelContentMessageImpl(
messageId = sourceMessage.messageId, messageId = sourceMessage.messageId,
from = sourceMessage.from,
chat = sourceMessage.chat, chat = sourceMessage.chat,
content = content, content = content,
date = sourceMessage.date, date = sourceMessage.date,

View File

@ -11,6 +11,8 @@ package dev.inmo.tgbotapi.extensions.utils
import dev.inmo.tgbotapi.abstracts.CommonSendInvoiceData import dev.inmo.tgbotapi.abstracts.CommonSendInvoiceData
import dev.inmo.tgbotapi.abstracts.FromUser import dev.inmo.tgbotapi.abstracts.FromUser
import dev.inmo.tgbotapi.abstracts.OptionallyFromUser
import dev.inmo.tgbotapi.abstracts.OptionallyWithUser
import dev.inmo.tgbotapi.abstracts.WithUser import dev.inmo.tgbotapi.abstracts.WithUser
import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton
import dev.inmo.tgbotapi.requests.send.payments.CreateInvoiceLink import dev.inmo.tgbotapi.requests.send.payments.CreateInvoiceLink
@ -296,6 +298,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.GroupContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage import dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage
import dev.inmo.tgbotapi.types.message.abstracts.InaccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.InaccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.OptionallyFromUserMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyEditedMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblyEditedMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage
@ -525,519 +528,573 @@ public inline fun <T>
CommonSendInvoiceData.ifInputInvoiceMessageContent(block: (InputInvoiceMessageContent) -> T): T? CommonSendInvoiceData.ifInputInvoiceMessageContent(block: (InputInvoiceMessageContent) -> T): T?
= inputInvoiceMessageContentOrNull() ?.let(block) = inputInvoiceMessageContentOrNull() ?.let(block)
public inline fun WithUser.fromUserOrNull(): FromUser? = this as? public inline fun OptionallyWithUser.optionallyFromUserOrNull(): OptionallyFromUser? = this as?
dev.inmo.tgbotapi.abstracts.OptionallyFromUser
public inline fun OptionallyWithUser.optionallyFromUserOrThrow(): OptionallyFromUser = this as
dev.inmo.tgbotapi.abstracts.OptionallyFromUser
public inline fun <T> OptionallyWithUser.ifOptionallyFromUser(block: (OptionallyFromUser) -> T): T?
= optionallyFromUserOrNull() ?.let(block)
public inline fun OptionallyWithUser.fromUserOrNull(): FromUser? = this as?
dev.inmo.tgbotapi.abstracts.FromUser dev.inmo.tgbotapi.abstracts.FromUser
public inline fun WithUser.fromUserOrThrow(): FromUser = this as public inline fun OptionallyWithUser.fromUserOrThrow(): FromUser = this as
dev.inmo.tgbotapi.abstracts.FromUser dev.inmo.tgbotapi.abstracts.FromUser
public inline fun <T> WithUser.ifFromUser(block: (FromUser) -> T): T? = fromUserOrNull() public inline fun <T> OptionallyWithUser.ifFromUser(block: (FromUser) -> T): T? = fromUserOrNull()
?.let(block) ?.let(block)
public inline fun WithUser.chatInviteLinkOrNull(): ChatInviteLink? = this as? public inline fun OptionallyWithUser.withUserOrNull(): WithUser? = this as?
dev.inmo.tgbotapi.abstracts.WithUser
public inline fun OptionallyWithUser.withUserOrThrow(): WithUser = this as
dev.inmo.tgbotapi.abstracts.WithUser
public inline fun <T> OptionallyWithUser.ifWithUser(block: (WithUser) -> T): T? = withUserOrNull()
?.let(block)
public inline fun OptionallyWithUser.chatInviteLinkOrNull(): ChatInviteLink? = this as?
dev.inmo.tgbotapi.types.ChatInviteLink dev.inmo.tgbotapi.types.ChatInviteLink
public inline fun WithUser.chatInviteLinkOrThrow(): ChatInviteLink = this as public inline fun OptionallyWithUser.chatInviteLinkOrThrow(): ChatInviteLink = this as
dev.inmo.tgbotapi.types.ChatInviteLink dev.inmo.tgbotapi.types.ChatInviteLink
public inline fun <T> WithUser.ifChatInviteLink(block: (ChatInviteLink) -> T): T? = public inline fun <T> OptionallyWithUser.ifChatInviteLink(block: (ChatInviteLink) -> T): T? =
chatInviteLinkOrNull() ?.let(block) chatInviteLinkOrNull() ?.let(block)
public inline fun WithUser.secondaryChatInviteLinkOrNull(): SecondaryChatInviteLink? = this as? public inline fun OptionallyWithUser.secondaryChatInviteLinkOrNull(): SecondaryChatInviteLink? =
dev.inmo.tgbotapi.types.SecondaryChatInviteLink this as? dev.inmo.tgbotapi.types.SecondaryChatInviteLink
public inline fun WithUser.secondaryChatInviteLinkOrThrow(): SecondaryChatInviteLink = this as public inline fun OptionallyWithUser.secondaryChatInviteLinkOrThrow(): SecondaryChatInviteLink =
dev.inmo.tgbotapi.types.SecondaryChatInviteLink this as dev.inmo.tgbotapi.types.SecondaryChatInviteLink
public inline fun <T> WithUser.ifSecondaryChatInviteLink(block: (SecondaryChatInviteLink) -> T): T?
= secondaryChatInviteLinkOrNull() ?.let(block)
public inline fun WithUser.primaryInviteLinkOrNull(): PrimaryInviteLink? = this as?
dev.inmo.tgbotapi.types.PrimaryInviteLink
public inline fun WithUser.primaryInviteLinkOrThrow(): PrimaryInviteLink = this as
dev.inmo.tgbotapi.types.PrimaryInviteLink
public inline fun <T> WithUser.ifPrimaryInviteLink(block: (PrimaryInviteLink) -> T): T? =
primaryInviteLinkOrNull() ?.let(block)
public inline fun WithUser.chatInviteLinkWithJoinRequestOrNull(): ChatInviteLinkWithJoinRequest? =
this as? dev.inmo.tgbotapi.types.ChatInviteLinkWithJoinRequest
public inline fun WithUser.chatInviteLinkWithJoinRequestOrThrow(): ChatInviteLinkWithJoinRequest =
this as dev.inmo.tgbotapi.types.ChatInviteLinkWithJoinRequest
public inline fun <T> public inline fun <T>
WithUser.ifChatInviteLinkWithJoinRequest(block: (ChatInviteLinkWithJoinRequest) -> T): T? = OptionallyWithUser.ifSecondaryChatInviteLink(block: (SecondaryChatInviteLink) -> T): T? =
chatInviteLinkWithJoinRequestOrNull() ?.let(block) secondaryChatInviteLinkOrNull() ?.let(block)
public inline fun WithUser.chatInviteLinkWithLimitedMembersOrNull(): public inline fun OptionallyWithUser.primaryInviteLinkOrNull(): PrimaryInviteLink? = this as?
dev.inmo.tgbotapi.types.PrimaryInviteLink
public inline fun OptionallyWithUser.primaryInviteLinkOrThrow(): PrimaryInviteLink = this as
dev.inmo.tgbotapi.types.PrimaryInviteLink
public inline fun <T> OptionallyWithUser.ifPrimaryInviteLink(block: (PrimaryInviteLink) -> T): T? =
primaryInviteLinkOrNull() ?.let(block)
public inline fun OptionallyWithUser.chatInviteLinkWithJoinRequestOrNull():
ChatInviteLinkWithJoinRequest? = this as? dev.inmo.tgbotapi.types.ChatInviteLinkWithJoinRequest
public inline fun OptionallyWithUser.chatInviteLinkWithJoinRequestOrThrow():
ChatInviteLinkWithJoinRequest = this as dev.inmo.tgbotapi.types.ChatInviteLinkWithJoinRequest
public inline fun <T>
OptionallyWithUser.ifChatInviteLinkWithJoinRequest(block: (ChatInviteLinkWithJoinRequest) -> T):
T? = chatInviteLinkWithJoinRequestOrNull() ?.let(block)
public inline fun OptionallyWithUser.chatInviteLinkWithLimitedMembersOrNull():
ChatInviteLinkWithLimitedMembers? = this as? ChatInviteLinkWithLimitedMembers? = this as?
dev.inmo.tgbotapi.types.ChatInviteLinkWithLimitedMembers dev.inmo.tgbotapi.types.ChatInviteLinkWithLimitedMembers
public inline fun WithUser.chatInviteLinkWithLimitedMembersOrThrow(): public inline fun OptionallyWithUser.chatInviteLinkWithLimitedMembersOrThrow():
ChatInviteLinkWithLimitedMembers = this as ChatInviteLinkWithLimitedMembers = this as
dev.inmo.tgbotapi.types.ChatInviteLinkWithLimitedMembers dev.inmo.tgbotapi.types.ChatInviteLinkWithLimitedMembers
public inline fun <T> public inline fun <T>
WithUser.ifChatInviteLinkWithLimitedMembers(block: (ChatInviteLinkWithLimitedMembers) -> T): T? OptionallyWithUser.ifChatInviteLinkWithLimitedMembers(block: (ChatInviteLinkWithLimitedMembers) -> T):
= chatInviteLinkWithLimitedMembersOrNull() ?.let(block) T? = chatInviteLinkWithLimitedMembersOrNull() ?.let(block)
public inline fun WithUser.chatInviteLinkUnlimitedOrNull(): ChatInviteLinkUnlimited? = this as? public inline fun OptionallyWithUser.chatInviteLinkUnlimitedOrNull(): ChatInviteLinkUnlimited? =
dev.inmo.tgbotapi.types.ChatInviteLinkUnlimited this as? dev.inmo.tgbotapi.types.ChatInviteLinkUnlimited
public inline fun WithUser.chatInviteLinkUnlimitedOrThrow(): ChatInviteLinkUnlimited = this as public inline fun OptionallyWithUser.chatInviteLinkUnlimitedOrThrow(): ChatInviteLinkUnlimited =
dev.inmo.tgbotapi.types.ChatInviteLinkUnlimited this as dev.inmo.tgbotapi.types.ChatInviteLinkUnlimited
public inline fun <T> WithUser.ifChatInviteLinkUnlimited(block: (ChatInviteLinkUnlimited) -> T): T? public inline fun <T>
= chatInviteLinkUnlimitedOrNull() ?.let(block) OptionallyWithUser.ifChatInviteLinkUnlimited(block: (ChatInviteLinkUnlimited) -> T): T? =
chatInviteLinkUnlimitedOrNull() ?.let(block)
public inline fun WithUser.baseChosenInlineResultOrNull(): BaseChosenInlineResult? = this as? public inline fun OptionallyWithUser.baseChosenInlineResultOrNull(): BaseChosenInlineResult? = this
dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult as? dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult
public inline fun WithUser.baseChosenInlineResultOrThrow(): BaseChosenInlineResult = this as public inline fun OptionallyWithUser.baseChosenInlineResultOrThrow(): BaseChosenInlineResult = this
dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult as dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult
public inline fun <T> WithUser.ifBaseChosenInlineResult(block: (BaseChosenInlineResult) -> T): T? = public inline fun <T>
OptionallyWithUser.ifBaseChosenInlineResult(block: (BaseChosenInlineResult) -> T): T? =
baseChosenInlineResultOrNull() ?.let(block) baseChosenInlineResultOrNull() ?.let(block)
public inline fun WithUser.chosenInlineResultOrNull(): ChosenInlineResult? = this as? public inline fun OptionallyWithUser.chosenInlineResultOrNull(): ChosenInlineResult? = this as?
dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
public inline fun WithUser.chosenInlineResultOrThrow(): ChosenInlineResult = this as public inline fun OptionallyWithUser.chosenInlineResultOrThrow(): ChosenInlineResult = this as
dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
public inline fun <T> WithUser.ifChosenInlineResult(block: (ChosenInlineResult) -> T): T? = public inline fun <T> OptionallyWithUser.ifChosenInlineResult(block: (ChosenInlineResult) -> T): T?
chosenInlineResultOrNull() ?.let(block) = chosenInlineResultOrNull() ?.let(block)
public inline fun WithUser.locationChosenInlineResultOrNull(): LocationChosenInlineResult? = this public inline fun OptionallyWithUser.locationChosenInlineResultOrNull(): LocationChosenInlineResult?
as? dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult = this as? dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult
public inline fun WithUser.locationChosenInlineResultOrThrow(): LocationChosenInlineResult = this as public inline fun OptionallyWithUser.locationChosenInlineResultOrThrow(): LocationChosenInlineResult
dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult = this as dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult
public inline fun <T> public inline fun <T>
WithUser.ifLocationChosenInlineResult(block: (LocationChosenInlineResult) -> T): T? = OptionallyWithUser.ifLocationChosenInlineResult(block: (LocationChosenInlineResult) -> T): T? =
locationChosenInlineResultOrNull() ?.let(block) locationChosenInlineResultOrNull() ?.let(block)
public inline fun WithUser.baseInlineQueryOrNull(): BaseInlineQuery? = this as? public inline fun OptionallyWithUser.baseInlineQueryOrNull(): BaseInlineQuery? = this as?
dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery
public inline fun WithUser.baseInlineQueryOrThrow(): BaseInlineQuery = this as public inline fun OptionallyWithUser.baseInlineQueryOrThrow(): BaseInlineQuery = this as
dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery
public inline fun <T> WithUser.ifBaseInlineQuery(block: (BaseInlineQuery) -> T): T? = public inline fun <T> OptionallyWithUser.ifBaseInlineQuery(block: (BaseInlineQuery) -> T): T? =
baseInlineQueryOrNull() ?.let(block) baseInlineQueryOrNull() ?.let(block)
public inline fun WithUser.inlineQueryOrNull(): InlineQuery? = this as? public inline fun OptionallyWithUser.inlineQueryOrNull(): InlineQuery? = this as?
dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
public inline fun WithUser.inlineQueryOrThrow(): InlineQuery = this as public inline fun OptionallyWithUser.inlineQueryOrThrow(): InlineQuery = this as
dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
public inline fun <T> WithUser.ifInlineQuery(block: (InlineQuery) -> T): T? = inlineQueryOrNull() public inline fun <T> OptionallyWithUser.ifInlineQuery(block: (InlineQuery) -> T): T? =
?.let(block) inlineQueryOrNull() ?.let(block)
public inline fun WithUser.locationInlineQueryOrNull(): LocationInlineQuery? = this as? public inline fun OptionallyWithUser.locationInlineQueryOrNull(): LocationInlineQuery? = this as?
dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery
public inline fun WithUser.locationInlineQueryOrThrow(): LocationInlineQuery = this as public inline fun OptionallyWithUser.locationInlineQueryOrThrow(): LocationInlineQuery = this as
dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery
public inline fun <T> WithUser.ifLocationInlineQuery(block: (LocationInlineQuery) -> T): T? = public inline fun <T> OptionallyWithUser.ifLocationInlineQuery(block: (LocationInlineQuery) -> T):
locationInlineQueryOrNull() ?.let(block) T? = locationInlineQueryOrNull() ?.let(block)
public inline fun WithUser.chatJoinRequestOrNull(): ChatJoinRequest? = this as? public inline fun OptionallyWithUser.chatJoinRequestOrNull(): ChatJoinRequest? = this as?
dev.inmo.tgbotapi.types.chat.ChatJoinRequest dev.inmo.tgbotapi.types.chat.ChatJoinRequest
public inline fun WithUser.chatJoinRequestOrThrow(): ChatJoinRequest = this as public inline fun OptionallyWithUser.chatJoinRequestOrThrow(): ChatJoinRequest = this as
dev.inmo.tgbotapi.types.chat.ChatJoinRequest dev.inmo.tgbotapi.types.chat.ChatJoinRequest
public inline fun <T> WithUser.ifChatJoinRequest(block: (ChatJoinRequest) -> T): T? = public inline fun <T> OptionallyWithUser.ifChatJoinRequest(block: (ChatJoinRequest) -> T): T? =
chatJoinRequestOrNull() ?.let(block) chatJoinRequestOrNull() ?.let(block)
public inline fun WithUser.administratorChatMemberOrNull(): AdministratorChatMember? = this as? public inline fun OptionallyWithUser.administratorChatMemberOrNull(): AdministratorChatMember? =
dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember this as? dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
public inline fun WithUser.administratorChatMemberOrThrow(): AdministratorChatMember = this as public inline fun OptionallyWithUser.administratorChatMemberOrThrow(): AdministratorChatMember =
dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember this as dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
public inline fun <T> WithUser.ifAdministratorChatMember(block: (AdministratorChatMember) -> T): T? public inline fun <T>
= administratorChatMemberOrNull() ?.let(block) OptionallyWithUser.ifAdministratorChatMember(block: (AdministratorChatMember) -> T): T? =
administratorChatMemberOrNull() ?.let(block)
public inline fun WithUser.bannedChatMemberOrNull(): BannedChatMember? = this as? public inline fun OptionallyWithUser.bannedChatMemberOrNull(): BannedChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.BannedChatMember dev.inmo.tgbotapi.types.chat.member.BannedChatMember
public inline fun WithUser.bannedChatMemberOrThrow(): BannedChatMember = this as public inline fun OptionallyWithUser.bannedChatMemberOrThrow(): BannedChatMember = this as
dev.inmo.tgbotapi.types.chat.member.BannedChatMember dev.inmo.tgbotapi.types.chat.member.BannedChatMember
public inline fun <T> WithUser.ifBannedChatMember(block: (BannedChatMember) -> T): T? = public inline fun <T> OptionallyWithUser.ifBannedChatMember(block: (BannedChatMember) -> T): T? =
bannedChatMemberOrNull() ?.let(block) bannedChatMemberOrNull() ?.let(block)
public inline fun WithUser.chatMemberOrNull(): ChatMember? = this as? public inline fun OptionallyWithUser.chatMemberOrNull(): ChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.ChatMember dev.inmo.tgbotapi.types.chat.member.ChatMember
public inline fun WithUser.chatMemberOrThrow(): ChatMember = this as public inline fun OptionallyWithUser.chatMemberOrThrow(): ChatMember = this as
dev.inmo.tgbotapi.types.chat.member.ChatMember dev.inmo.tgbotapi.types.chat.member.ChatMember
public inline fun <T> WithUser.ifChatMember(block: (ChatMember) -> T): T? = chatMemberOrNull() public inline fun <T> OptionallyWithUser.ifChatMember(block: (ChatMember) -> T): T? =
?.let(block) chatMemberOrNull() ?.let(block)
public inline fun WithUser.chatMemberUpdatedOrNull(): ChatMemberUpdated? = this as? public inline fun OptionallyWithUser.chatMemberUpdatedOrNull(): ChatMemberUpdated? = this as?
dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
public inline fun WithUser.chatMemberUpdatedOrThrow(): ChatMemberUpdated = this as public inline fun OptionallyWithUser.chatMemberUpdatedOrThrow(): ChatMemberUpdated = this as
dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
public inline fun <T> WithUser.ifChatMemberUpdated(block: (ChatMemberUpdated) -> T): T? = public inline fun <T> OptionallyWithUser.ifChatMemberUpdated(block: (ChatMemberUpdated) -> T): T? =
chatMemberUpdatedOrNull() ?.let(block) chatMemberUpdatedOrNull() ?.let(block)
public inline fun WithUser.kickedChatMemberOrNull(): KickedChatMember? = this as? public inline fun OptionallyWithUser.kickedChatMemberOrNull(): KickedChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.KickedChatMember dev.inmo.tgbotapi.types.chat.member.KickedChatMember
public inline fun WithUser.kickedChatMemberOrThrow(): KickedChatMember = this as public inline fun OptionallyWithUser.kickedChatMemberOrThrow(): KickedChatMember = this as
dev.inmo.tgbotapi.types.chat.member.KickedChatMember dev.inmo.tgbotapi.types.chat.member.KickedChatMember
public inline fun <T> WithUser.ifKickedChatMember(block: (KickedChatMember) -> T): T? = public inline fun <T> OptionallyWithUser.ifKickedChatMember(block: (KickedChatMember) -> T): T? =
kickedChatMemberOrNull() ?.let(block) kickedChatMemberOrNull() ?.let(block)
public inline fun WithUser.leftChatMemberOrNull(): LeftChatMember? = this as? public inline fun OptionallyWithUser.leftChatMemberOrNull(): LeftChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.LeftChatMember dev.inmo.tgbotapi.types.chat.member.LeftChatMember
public inline fun WithUser.leftChatMemberOrThrow(): LeftChatMember = this as public inline fun OptionallyWithUser.leftChatMemberOrThrow(): LeftChatMember = this as
dev.inmo.tgbotapi.types.chat.member.LeftChatMember dev.inmo.tgbotapi.types.chat.member.LeftChatMember
public inline fun <T> WithUser.ifLeftChatMember(block: (LeftChatMember) -> T): T? = public inline fun <T> OptionallyWithUser.ifLeftChatMember(block: (LeftChatMember) -> T): T? =
leftChatMemberOrNull() ?.let(block) leftChatMemberOrNull() ?.let(block)
public inline fun WithUser.memberChatMemberOrNull(): MemberChatMember? = this as? public inline fun OptionallyWithUser.memberChatMemberOrNull(): MemberChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.MemberChatMember dev.inmo.tgbotapi.types.chat.member.MemberChatMember
public inline fun WithUser.memberChatMemberOrThrow(): MemberChatMember = this as public inline fun OptionallyWithUser.memberChatMemberOrThrow(): MemberChatMember = this as
dev.inmo.tgbotapi.types.chat.member.MemberChatMember dev.inmo.tgbotapi.types.chat.member.MemberChatMember
public inline fun <T> WithUser.ifMemberChatMember(block: (MemberChatMember) -> T): T? = public inline fun <T> OptionallyWithUser.ifMemberChatMember(block: (MemberChatMember) -> T): T? =
memberChatMemberOrNull() ?.let(block) memberChatMemberOrNull() ?.let(block)
public inline fun WithUser.ownerChatMemberOrNull(): OwnerChatMember? = this as? public inline fun OptionallyWithUser.ownerChatMemberOrNull(): OwnerChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.OwnerChatMember dev.inmo.tgbotapi.types.chat.member.OwnerChatMember
public inline fun WithUser.ownerChatMemberOrThrow(): OwnerChatMember = this as public inline fun OptionallyWithUser.ownerChatMemberOrThrow(): OwnerChatMember = this as
dev.inmo.tgbotapi.types.chat.member.OwnerChatMember dev.inmo.tgbotapi.types.chat.member.OwnerChatMember
public inline fun <T> WithUser.ifOwnerChatMember(block: (OwnerChatMember) -> T): T? = public inline fun <T> OptionallyWithUser.ifOwnerChatMember(block: (OwnerChatMember) -> T): T? =
ownerChatMemberOrNull() ?.let(block) ownerChatMemberOrNull() ?.let(block)
public inline fun WithUser.restrictedChatMemberOrNull(): RestrictedChatMember? = this as? public inline fun OptionallyWithUser.restrictedChatMemberOrNull(): RestrictedChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember
public inline fun WithUser.restrictedChatMemberOrThrow(): RestrictedChatMember = this as public inline fun OptionallyWithUser.restrictedChatMemberOrThrow(): RestrictedChatMember = this as
dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember
public inline fun <T> WithUser.ifRestrictedChatMember(block: (RestrictedChatMember) -> T): T? = public inline fun <T> OptionallyWithUser.ifRestrictedChatMember(block: (RestrictedChatMember) -> T):
restrictedChatMemberOrNull() ?.let(block) T? = restrictedChatMemberOrNull() ?.let(block)
public inline fun WithUser.specialRightsChatMemberOrNull(): SpecialRightsChatMember? = this as? public inline fun OptionallyWithUser.specialRightsChatMemberOrNull(): SpecialRightsChatMember? =
dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember this as? dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember
public inline fun WithUser.specialRightsChatMemberOrThrow(): SpecialRightsChatMember = this as public inline fun OptionallyWithUser.specialRightsChatMemberOrThrow(): SpecialRightsChatMember =
dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember this as dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember
public inline fun <T> WithUser.ifSpecialRightsChatMember(block: (SpecialRightsChatMember) -> T): T? public inline fun <T>
= specialRightsChatMemberOrNull() ?.let(block) OptionallyWithUser.ifSpecialRightsChatMember(block: (SpecialRightsChatMember) -> T): T? =
specialRightsChatMemberOrNull() ?.let(block)
public inline fun WithUser.leftChatMemberEventOrNull(): LeftChatMemberEvent? = this as? public inline fun OptionallyWithUser.leftChatMemberEventOrNull(): LeftChatMemberEvent? = this as?
dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent
public inline fun WithUser.leftChatMemberEventOrThrow(): LeftChatMemberEvent = this as public inline fun OptionallyWithUser.leftChatMemberEventOrThrow(): LeftChatMemberEvent = this as
dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent
public inline fun <T> WithUser.ifLeftChatMemberEvent(block: (LeftChatMemberEvent) -> T): T? = public inline fun <T> OptionallyWithUser.ifLeftChatMemberEvent(block: (LeftChatMemberEvent) -> T):
leftChatMemberEventOrNull() ?.let(block) T? = leftChatMemberEventOrNull() ?.let(block)
public inline fun WithUser.commonGroupEventMessageOrNull(): CommonGroupEventMessage<GroupEvent>? = public inline fun OptionallyWithUser.commonGroupEventMessageOrNull():
this as? CommonGroupEventMessage<GroupEvent>? = this as?
dev.inmo.tgbotapi.types.message.CommonGroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent> dev.inmo.tgbotapi.types.message.CommonGroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent>
public inline fun WithUser.commonGroupEventMessageOrThrow(): CommonGroupEventMessage<GroupEvent> = public inline fun OptionallyWithUser.commonGroupEventMessageOrThrow():
this as CommonGroupEventMessage<GroupEvent> = this as
dev.inmo.tgbotapi.types.message.CommonGroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent> dev.inmo.tgbotapi.types.message.CommonGroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent>
public inline fun <T> public inline fun <T>
WithUser.ifCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T): T? = OptionallyWithUser.ifCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T):
commonGroupEventMessageOrNull() ?.let(block) T? = commonGroupEventMessageOrNull() ?.let(block)
public inline fun WithUser.commonSupergroupEventMessageOrNull(): public inline fun OptionallyWithUser.commonSupergroupEventMessageOrNull():
CommonSupergroupEventMessage<SupergroupEvent>? = this as? CommonSupergroupEventMessage<SupergroupEvent>? = this as?
dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent> dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent>
public inline fun WithUser.commonSupergroupEventMessageOrThrow(): public inline fun OptionallyWithUser.commonSupergroupEventMessageOrThrow():
CommonSupergroupEventMessage<SupergroupEvent> = this as CommonSupergroupEventMessage<SupergroupEvent> = this as
dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent> dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent>
public inline fun <T> public inline fun <T>
WithUser.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T): OptionallyWithUser.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T):
T? = commonSupergroupEventMessageOrNull() ?.let(block) T? = commonSupergroupEventMessageOrNull() ?.let(block)
public inline fun WithUser.passportMessageOrNull(): PassportMessage? = this as? public inline fun OptionallyWithUser.passportMessageOrNull(): PassportMessage? = this as?
dev.inmo.tgbotapi.types.message.PassportMessage dev.inmo.tgbotapi.types.message.PassportMessage
public inline fun WithUser.passportMessageOrThrow(): PassportMessage = this as public inline fun OptionallyWithUser.passportMessageOrThrow(): PassportMessage = this as
dev.inmo.tgbotapi.types.message.PassportMessage dev.inmo.tgbotapi.types.message.PassportMessage
public inline fun <T> WithUser.ifPassportMessage(block: (PassportMessage) -> T): T? = public inline fun <T> OptionallyWithUser.ifPassportMessage(block: (PassportMessage) -> T): T? =
passportMessageOrNull() ?.let(block) passportMessageOrNull() ?.let(block)
public inline fun WithUser.businessContentMessageOrNull(): BusinessContentMessage<MessageContent>? = public inline fun OptionallyWithUser.businessContentMessageOrNull():
this as? BusinessContentMessage<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent> dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun WithUser.businessContentMessageOrThrow(): BusinessContentMessage<MessageContent> = public inline fun OptionallyWithUser.businessContentMessageOrThrow():
this as BusinessContentMessage<MessageContent> = this as
dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent> dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T> public inline fun <T>
WithUser.ifBusinessContentMessage(block: (BusinessContentMessage<MessageContent>) -> T): T? = OptionallyWithUser.ifBusinessContentMessage(block: (BusinessContentMessage<MessageContent>) -> T):
businessContentMessageOrNull() ?.let(block) T? = businessContentMessageOrNull() ?.let(block)
public inline fun WithUser.fromUserMessageOrNull(): FromUserMessage? = this as? public inline fun OptionallyWithUser.channelContentMessageOrNull():
ChannelContentMessage<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun OptionallyWithUser.channelContentMessageOrThrow():
ChannelContentMessage<MessageContent> = this as
dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
OptionallyWithUser.ifChannelContentMessage(block: (ChannelContentMessage<MessageContent>) -> T):
T? = channelContentMessageOrNull() ?.let(block)
public inline fun OptionallyWithUser.optionallyFromUserMessageOrNull(): OptionallyFromUserMessage? =
this as? dev.inmo.tgbotapi.types.message.abstracts.OptionallyFromUserMessage
public inline fun OptionallyWithUser.optionallyFromUserMessageOrThrow(): OptionallyFromUserMessage =
this as dev.inmo.tgbotapi.types.message.abstracts.OptionallyFromUserMessage
public inline fun <T>
OptionallyWithUser.ifOptionallyFromUserMessage(block: (OptionallyFromUserMessage) -> T): T? =
optionallyFromUserMessageOrNull() ?.let(block)
public inline fun OptionallyWithUser.fromUserMessageOrNull(): FromUserMessage? = this as?
dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
public inline fun WithUser.fromUserMessageOrThrow(): FromUserMessage = this as public inline fun OptionallyWithUser.fromUserMessageOrThrow(): FromUserMessage = this as
dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
public inline fun <T> WithUser.ifFromUserMessage(block: (FromUserMessage) -> T): T? = public inline fun <T> OptionallyWithUser.ifFromUserMessage(block: (FromUserMessage) -> T): T? =
fromUserMessageOrNull() ?.let(block) fromUserMessageOrNull() ?.let(block)
public inline fun WithUser.groupEventMessageOrNull(): GroupEventMessage<GroupEvent>? = this as? public inline fun OptionallyWithUser.groupEventMessageOrNull(): GroupEventMessage<GroupEvent>? =
this as?
dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent> dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent>
public inline fun WithUser.groupEventMessageOrThrow(): GroupEventMessage<GroupEvent> = this as public inline fun OptionallyWithUser.groupEventMessageOrThrow(): GroupEventMessage<GroupEvent> =
this as
dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent> dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent>
public inline fun <T> WithUser.ifGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T): T? public inline fun <T>
= groupEventMessageOrNull() ?.let(block) OptionallyWithUser.ifGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T): T? =
groupEventMessageOrNull() ?.let(block)
public inline fun WithUser.commonGroupContentMessageOrNull(): public inline fun OptionallyWithUser.commonGroupContentMessageOrNull():
CommonGroupContentMessage<MessageContent>? = this as? CommonGroupContentMessage<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent> dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun WithUser.commonGroupContentMessageOrThrow(): public inline fun OptionallyWithUser.commonGroupContentMessageOrThrow():
CommonGroupContentMessage<MessageContent> = this as CommonGroupContentMessage<MessageContent> = this as
dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent> dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T> public inline fun <T>
WithUser.ifCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T): OptionallyWithUser.ifCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T):
T? = commonGroupContentMessageOrNull() ?.let(block) T? = commonGroupContentMessageOrNull() ?.let(block)
public inline fun WithUser.commonForumContentMessageOrNull(): public inline fun OptionallyWithUser.commonForumContentMessageOrNull():
CommonForumContentMessage<MessageContent>? = this as? CommonForumContentMessage<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent> dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun WithUser.commonForumContentMessageOrThrow(): public inline fun OptionallyWithUser.commonForumContentMessageOrThrow():
CommonForumContentMessage<MessageContent> = this as CommonForumContentMessage<MessageContent> = this as
dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent> dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T> public inline fun <T>
WithUser.ifCommonForumContentMessage(block: (CommonForumContentMessage<MessageContent>) -> T): OptionallyWithUser.ifCommonForumContentMessage(block: (CommonForumContentMessage<MessageContent>) -> T):
T? = commonForumContentMessageOrNull() ?.let(block) T? = commonForumContentMessageOrNull() ?.let(block)
public inline fun WithUser.privateContentMessageOrNull(): PrivateContentMessage<MessageContent>? = public inline fun OptionallyWithUser.privateContentMessageOrNull():
this as? PrivateContentMessage<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent> dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun WithUser.privateContentMessageOrThrow(): PrivateContentMessage<MessageContent> = public inline fun OptionallyWithUser.privateContentMessageOrThrow():
this as PrivateContentMessage<MessageContent> = this as
dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent> dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T> public inline fun <T>
WithUser.ifPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T): T? = OptionallyWithUser.ifPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T):
privateContentMessageOrNull() ?.let(block) T? = privateContentMessageOrNull() ?.let(block)
public inline fun WithUser.supergroupEventMessageOrNull(): SupergroupEventMessage<SupergroupEvent>? public inline fun OptionallyWithUser.supergroupEventMessageOrNull():
= this as? SupergroupEventMessage<SupergroupEvent>? = this as?
dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent> dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent>
public inline fun WithUser.supergroupEventMessageOrThrow(): SupergroupEventMessage<SupergroupEvent> public inline fun OptionallyWithUser.supergroupEventMessageOrThrow():
= this as SupergroupEventMessage<SupergroupEvent> = this as
dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent> dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent>
public inline fun <T> public inline fun <T>
WithUser.ifSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T): T? = OptionallyWithUser.ifSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T):
supergroupEventMessageOrNull() ?.let(block) T? = supergroupEventMessageOrNull() ?.let(block)
public inline fun WithUser.preCheckoutQueryOrNull(): PreCheckoutQuery? = this as? public inline fun OptionallyWithUser.preCheckoutQueryOrNull(): PreCheckoutQuery? = this as?
dev.inmo.tgbotapi.types.payments.PreCheckoutQuery dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
public inline fun WithUser.preCheckoutQueryOrThrow(): PreCheckoutQuery = this as public inline fun OptionallyWithUser.preCheckoutQueryOrThrow(): PreCheckoutQuery = this as
dev.inmo.tgbotapi.types.payments.PreCheckoutQuery dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
public inline fun <T> WithUser.ifPreCheckoutQuery(block: (PreCheckoutQuery) -> T): T? = public inline fun <T> OptionallyWithUser.ifPreCheckoutQuery(block: (PreCheckoutQuery) -> T): T? =
preCheckoutQueryOrNull() ?.let(block) preCheckoutQueryOrNull() ?.let(block)
public inline fun WithUser.shippingQueryOrNull(): ShippingQuery? = this as? public inline fun OptionallyWithUser.shippingQueryOrNull(): ShippingQuery? = this as?
dev.inmo.tgbotapi.types.payments.ShippingQuery dev.inmo.tgbotapi.types.payments.ShippingQuery
public inline fun WithUser.shippingQueryOrThrow(): ShippingQuery = this as public inline fun OptionallyWithUser.shippingQueryOrThrow(): ShippingQuery = this as
dev.inmo.tgbotapi.types.payments.ShippingQuery dev.inmo.tgbotapi.types.payments.ShippingQuery
public inline fun <T> WithUser.ifShippingQuery(block: (ShippingQuery) -> T): T? = public inline fun <T> OptionallyWithUser.ifShippingQuery(block: (ShippingQuery) -> T): T? =
shippingQueryOrNull() ?.let(block) shippingQueryOrNull() ?.let(block)
public inline fun WithUser.pollAnswerOrNull(): PollAnswer? = this as? public inline fun OptionallyWithUser.pollAnswerOrNull(): PollAnswer? = this as?
dev.inmo.tgbotapi.types.polls.PollAnswer dev.inmo.tgbotapi.types.polls.PollAnswer
public inline fun WithUser.pollAnswerOrThrow(): PollAnswer = this as public inline fun OptionallyWithUser.pollAnswerOrThrow(): PollAnswer = this as
dev.inmo.tgbotapi.types.polls.PollAnswer dev.inmo.tgbotapi.types.polls.PollAnswer
public inline fun <T> WithUser.ifPollAnswer(block: (PollAnswer) -> T): T? = pollAnswerOrNull() public inline fun <T> OptionallyWithUser.ifPollAnswer(block: (PollAnswer) -> T): T? =
?.let(block) pollAnswerOrNull() ?.let(block)
public inline fun WithUser.abstractMessageCallbackQueryOrNull(): AbstractMessageCallbackQuery? = public inline fun OptionallyWithUser.abstractMessageCallbackQueryOrNull():
this as? dev.inmo.tgbotapi.types.queries.callback.AbstractMessageCallbackQuery AbstractMessageCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.AbstractMessageCallbackQuery
public inline fun WithUser.abstractMessageCallbackQueryOrThrow(): AbstractMessageCallbackQuery = public inline fun OptionallyWithUser.abstractMessageCallbackQueryOrThrow():
this as dev.inmo.tgbotapi.types.queries.callback.AbstractMessageCallbackQuery AbstractMessageCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.AbstractMessageCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifAbstractMessageCallbackQuery(block: (AbstractMessageCallbackQuery) -> T): T? = OptionallyWithUser.ifAbstractMessageCallbackQuery(block: (AbstractMessageCallbackQuery) -> T):
abstractMessageCallbackQueryOrNull() ?.let(block) T? = abstractMessageCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.callbackQueryOrNull(): CallbackQuery? = this as? public inline fun OptionallyWithUser.callbackQueryOrNull(): CallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.CallbackQuery dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
public inline fun WithUser.callbackQueryOrThrow(): CallbackQuery = this as public inline fun OptionallyWithUser.callbackQueryOrThrow(): CallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.CallbackQuery dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
public inline fun <T> WithUser.ifCallbackQuery(block: (CallbackQuery) -> T): T? = public inline fun <T> OptionallyWithUser.ifCallbackQuery(block: (CallbackQuery) -> T): T? =
callbackQueryOrNull() ?.let(block) callbackQueryOrNull() ?.let(block)
public inline fun WithUser.unknownCallbackQueryTypeOrNull(): UnknownCallbackQueryType? = this as? public inline fun OptionallyWithUser.unknownCallbackQueryTypeOrNull(): UnknownCallbackQueryType? =
dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType this as? dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType
public inline fun WithUser.unknownCallbackQueryTypeOrThrow(): UnknownCallbackQueryType = this as public inline fun OptionallyWithUser.unknownCallbackQueryTypeOrThrow(): UnknownCallbackQueryType =
dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType this as dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType
public inline fun <T> WithUser.ifUnknownCallbackQueryType(block: (UnknownCallbackQueryType) -> T):
T? = unknownCallbackQueryTypeOrNull() ?.let(block)
public inline fun WithUser.dataCallbackQueryOrNull(): DataCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery
public inline fun WithUser.dataCallbackQueryOrThrow(): DataCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery
public inline fun <T> WithUser.ifDataCallbackQuery(block: (DataCallbackQuery) -> T): T? =
dataCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.gameShortNameCallbackQueryOrNull(): GameShortNameCallbackQuery? = this
as? dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery
public inline fun WithUser.gameShortNameCallbackQueryOrThrow(): GameShortNameCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifGameShortNameCallbackQuery(block: (GameShortNameCallbackQuery) -> T): T? = OptionallyWithUser.ifUnknownCallbackQueryType(block: (UnknownCallbackQueryType) -> T): T? =
unknownCallbackQueryTypeOrNull() ?.let(block)
public inline fun OptionallyWithUser.dataCallbackQueryOrNull(): DataCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery
public inline fun OptionallyWithUser.dataCallbackQueryOrThrow(): DataCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery
public inline fun <T> OptionallyWithUser.ifDataCallbackQuery(block: (DataCallbackQuery) -> T): T? =
dataCallbackQueryOrNull() ?.let(block)
public inline fun OptionallyWithUser.gameShortNameCallbackQueryOrNull(): GameShortNameCallbackQuery?
= this as? dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery
public inline fun OptionallyWithUser.gameShortNameCallbackQueryOrThrow(): GameShortNameCallbackQuery
= this as dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery
public inline fun <T>
OptionallyWithUser.ifGameShortNameCallbackQuery(block: (GameShortNameCallbackQuery) -> T): T? =
gameShortNameCallbackQueryOrNull() ?.let(block) gameShortNameCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.inaccessibleMessageCallbackQueryOrNull(): public inline fun OptionallyWithUser.inaccessibleMessageCallbackQueryOrNull():
InaccessibleMessageCallbackQuery? = this as? InaccessibleMessageCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageCallbackQuery
public inline fun WithUser.inaccessibleMessageCallbackQueryOrThrow(): public inline fun OptionallyWithUser.inaccessibleMessageCallbackQueryOrThrow():
InaccessibleMessageCallbackQuery = this as InaccessibleMessageCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifInaccessibleMessageCallbackQuery(block: (InaccessibleMessageCallbackQuery) -> T): T? OptionallyWithUser.ifInaccessibleMessageCallbackQuery(block: (InaccessibleMessageCallbackQuery) -> T):
= inaccessibleMessageCallbackQueryOrNull() ?.let(block) T? = inaccessibleMessageCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.inaccessibleMessageDataCallbackQueryOrNull(): public inline fun OptionallyWithUser.inaccessibleMessageDataCallbackQueryOrNull():
InaccessibleMessageDataCallbackQuery? = this as? InaccessibleMessageDataCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageDataCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageDataCallbackQuery
public inline fun WithUser.inaccessibleMessageDataCallbackQueryOrThrow(): public inline fun OptionallyWithUser.inaccessibleMessageDataCallbackQueryOrThrow():
InaccessibleMessageDataCallbackQuery = this as InaccessibleMessageDataCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageDataCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageDataCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifInaccessibleMessageDataCallbackQuery(block: (InaccessibleMessageDataCallbackQuery) -> T): OptionallyWithUser.ifInaccessibleMessageDataCallbackQuery(block: (InaccessibleMessageDataCallbackQuery) -> T):
T? = inaccessibleMessageDataCallbackQueryOrNull() ?.let(block) T? = inaccessibleMessageDataCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.inaccessibleMessageGameShortNameCallbackQueryOrNull(): public inline fun OptionallyWithUser.inaccessibleMessageGameShortNameCallbackQueryOrNull():
InaccessibleMessageGameShortNameCallbackQuery? = this as? InaccessibleMessageGameShortNameCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageGameShortNameCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageGameShortNameCallbackQuery
public inline fun WithUser.inaccessibleMessageGameShortNameCallbackQueryOrThrow(): public inline fun OptionallyWithUser.inaccessibleMessageGameShortNameCallbackQueryOrThrow():
InaccessibleMessageGameShortNameCallbackQuery = this as InaccessibleMessageGameShortNameCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageGameShortNameCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InaccessibleMessageGameShortNameCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifInaccessibleMessageGameShortNameCallbackQuery(block: (InaccessibleMessageGameShortNameCallbackQuery) -> T): OptionallyWithUser.ifInaccessibleMessageGameShortNameCallbackQuery(block: (InaccessibleMessageGameShortNameCallbackQuery) -> T):
T? = inaccessibleMessageGameShortNameCallbackQueryOrNull() ?.let(block) T? = inaccessibleMessageGameShortNameCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.inlineMessageIdCallbackQueryOrNull(): InlineMessageIdCallbackQuery? = public inline fun OptionallyWithUser.inlineMessageIdCallbackQueryOrNull():
this as? dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery InlineMessageIdCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery
public inline fun WithUser.inlineMessageIdCallbackQueryOrThrow(): InlineMessageIdCallbackQuery = public inline fun OptionallyWithUser.inlineMessageIdCallbackQueryOrThrow():
this as dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery InlineMessageIdCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifInlineMessageIdCallbackQuery(block: (InlineMessageIdCallbackQuery) -> T): T? = OptionallyWithUser.ifInlineMessageIdCallbackQuery(block: (InlineMessageIdCallbackQuery) -> T):
inlineMessageIdCallbackQueryOrNull() ?.let(block) T? = inlineMessageIdCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.inlineMessageIdDataCallbackQueryOrNull(): public inline fun OptionallyWithUser.inlineMessageIdDataCallbackQueryOrNull():
InlineMessageIdDataCallbackQuery? = this as? InlineMessageIdDataCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery
public inline fun WithUser.inlineMessageIdDataCallbackQueryOrThrow(): public inline fun OptionallyWithUser.inlineMessageIdDataCallbackQueryOrThrow():
InlineMessageIdDataCallbackQuery = this as InlineMessageIdDataCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifInlineMessageIdDataCallbackQuery(block: (InlineMessageIdDataCallbackQuery) -> T): T? OptionallyWithUser.ifInlineMessageIdDataCallbackQuery(block: (InlineMessageIdDataCallbackQuery) -> T):
= inlineMessageIdDataCallbackQueryOrNull() ?.let(block) T? = inlineMessageIdDataCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.inlineMessageIdGameShortNameCallbackQueryOrNull(): public inline fun OptionallyWithUser.inlineMessageIdGameShortNameCallbackQueryOrNull():
InlineMessageIdGameShortNameCallbackQuery? = this as? InlineMessageIdGameShortNameCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery
public inline fun WithUser.inlineMessageIdGameShortNameCallbackQueryOrThrow(): public inline fun OptionallyWithUser.inlineMessageIdGameShortNameCallbackQueryOrThrow():
InlineMessageIdGameShortNameCallbackQuery = this as InlineMessageIdGameShortNameCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifInlineMessageIdGameShortNameCallbackQuery(block: (InlineMessageIdGameShortNameCallbackQuery) -> T): OptionallyWithUser.ifInlineMessageIdGameShortNameCallbackQuery(block: (InlineMessageIdGameShortNameCallbackQuery) -> T):
T? = inlineMessageIdGameShortNameCallbackQueryOrNull() ?.let(block) T? = inlineMessageIdGameShortNameCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.messageCallbackQueryOrNull(): MessageCallbackQuery? = this as? public inline fun OptionallyWithUser.messageCallbackQueryOrNull(): MessageCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery
public inline fun WithUser.messageCallbackQueryOrThrow(): MessageCallbackQuery = this as public inline fun OptionallyWithUser.messageCallbackQueryOrThrow(): MessageCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery
public inline fun <T> WithUser.ifMessageCallbackQuery(block: (MessageCallbackQuery) -> T): T? = public inline fun <T> OptionallyWithUser.ifMessageCallbackQuery(block: (MessageCallbackQuery) -> T):
messageCallbackQueryOrNull() ?.let(block) T? = messageCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.messageDataCallbackQueryOrNull(): MessageDataCallbackQuery? = this as? public inline fun OptionallyWithUser.messageDataCallbackQueryOrNull(): MessageDataCallbackQuery? =
dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery this as? dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery
public inline fun WithUser.messageDataCallbackQueryOrThrow(): MessageDataCallbackQuery = this as public inline fun OptionallyWithUser.messageDataCallbackQueryOrThrow(): MessageDataCallbackQuery =
dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery this as dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery
public inline fun <T> WithUser.ifMessageDataCallbackQuery(block: (MessageDataCallbackQuery) -> T): public inline fun <T>
T? = messageDataCallbackQueryOrNull() ?.let(block) OptionallyWithUser.ifMessageDataCallbackQuery(block: (MessageDataCallbackQuery) -> T): T? =
messageDataCallbackQueryOrNull() ?.let(block)
public inline fun WithUser.messageGameShortNameCallbackQueryOrNull(): public inline fun OptionallyWithUser.messageGameShortNameCallbackQueryOrNull():
MessageGameShortNameCallbackQuery? = this as? MessageGameShortNameCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery
public inline fun WithUser.messageGameShortNameCallbackQueryOrThrow(): public inline fun OptionallyWithUser.messageGameShortNameCallbackQueryOrThrow():
MessageGameShortNameCallbackQuery = this as MessageGameShortNameCallbackQuery = this as
dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery
public inline fun <T> public inline fun <T>
WithUser.ifMessageGameShortNameCallbackQuery(block: (MessageGameShortNameCallbackQuery) -> T): OptionallyWithUser.ifMessageGameShortNameCallbackQuery(block: (MessageGameShortNameCallbackQuery) -> T):
T? = messageGameShortNameCallbackQueryOrNull() ?.let(block) T? = messageGameShortNameCallbackQueryOrNull() ?.let(block)
public inline fun InlineQueryResultsButton.startOrNull(): InlineQueryResultsButton.Start? = this as? public inline fun InlineQueryResultsButton.startOrNull(): InlineQueryResultsButton.Start? = this as?
@ -3701,6 +3758,15 @@ public inline fun Message.contentMessageOrThrow(): ContentMessage<MessageContent
public inline fun <T> Message.ifContentMessage(block: (ContentMessage<MessageContent>) -> T): T? = public inline fun <T> Message.ifContentMessage(block: (ContentMessage<MessageContent>) -> T): T? =
contentMessageOrNull() ?.let(block) contentMessageOrNull() ?.let(block)
public inline fun Message.optionallyFromUserMessageOrNull(): OptionallyFromUserMessage? = this as?
dev.inmo.tgbotapi.types.message.abstracts.OptionallyFromUserMessage
public inline fun Message.optionallyFromUserMessageOrThrow(): OptionallyFromUserMessage = this as
dev.inmo.tgbotapi.types.message.abstracts.OptionallyFromUserMessage
public inline fun <T> Message.ifOptionallyFromUserMessage(block: (OptionallyFromUserMessage) -> T):
T? = optionallyFromUserMessageOrNull() ?.let(block)
public inline fun Message.fromUserMessageOrNull(): FromUserMessage? = this as? public inline fun Message.fromUserMessageOrNull(): FromUserMessage? = this as?
dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage

View File

@ -3,10 +3,21 @@
package dev.inmo.tgbotapi.extensions.utils package dev.inmo.tgbotapi.extensions.utils
import dev.inmo.tgbotapi.abstracts.FromUser import dev.inmo.tgbotapi.abstracts.FromUser
import dev.inmo.tgbotapi.abstracts.OptionallyFromUser
import dev.inmo.tgbotapi.abstracts.OptionallyWithUser
import dev.inmo.tgbotapi.abstracts.WithUser import dev.inmo.tgbotapi.abstracts.WithUser
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
import dev.inmo.tgbotapi.utils.PreviewFeature import dev.inmo.tgbotapi.utils.PreviewFeature
@PreviewFeature
inline fun <T> Any.ifOptionallyFromUser(block: (OptionallyFromUser) -> T) = optionallyFromUserOrNull()?.let(block)
@PreviewFeature
inline fun Any.optionallyFromUserOrNull(): OptionallyFromUser? = this as? OptionallyFromUser
@PreviewFeature
inline fun Any.optionallyFromUserOrThrow(): OptionallyFromUser = this as OptionallyFromUser
@PreviewFeature @PreviewFeature
inline fun <T> Any.ifFromUser(block: (FromUser) -> T) = fromUserOrNull()?.let(block) inline fun <T> Any.ifFromUser(block: (FromUser) -> T) = fromUserOrNull()?.let(block)
@ -16,6 +27,15 @@ inline fun Any.fromUserOrNull(): FromUser? = this as? FromUser
@PreviewFeature @PreviewFeature
inline fun Any.fromUserOrThrow(): FromUser = this as FromUser inline fun Any.fromUserOrThrow(): FromUser = this as FromUser
@PreviewFeature
inline fun <T> Any.ifOptionallyWithUser(block: (OptionallyWithUser) -> T) = optionallyWithUserOrNull()?.let(block)
@PreviewFeature
inline fun Any.optionallyWithUserOrNull(): OptionallyWithUser? = this as? OptionallyWithUser
@PreviewFeature
inline fun Any.optionallyWithUserOrThrow(): OptionallyWithUser = this as OptionallyWithUser
@PreviewFeature @PreviewFeature
inline fun <T> Any.ifWithUser(block: (WithUser) -> T) = withUserOrNull()?.let(block) inline fun <T> Any.ifWithUser(block: (WithUser) -> T) = withUserOrNull()?.let(block)

View File

@ -23,7 +23,7 @@ import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning) @RiskFeature(RawFieldsUsageWarning)
inline val Message.from: User? inline val Message.from: User?
get() = asFromUser() ?.from get() = optionallyFromUserMessageOrNull() ?.from
@RiskFeature(RawFieldsUsageWarning) @RiskFeature(RawFieldsUsageWarning)
inline val Message.sender_chat: PublicChat? inline val Message.sender_chat: PublicChat?
get() = asFromChannelGroupContentMessage() ?.senderChat get() = asFromChannelGroupContentMessage() ?.senderChat