1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

fixes in AccessibleMessage -> Message in several old parts

This commit is contained in:
InsanusMokrassar 2024-01-12 01:53:40 +06:00
parent 852065ad38
commit 66e31e5d0c
2 changed files with 148 additions and 148 deletions

View File

@ -978,346 +978,346 @@ inline fun SecureValue.requireSecureValueWithTranslations(): SecureValueWithTran
this as SecureValueWithTranslations
@PreviewFeature
inline fun <T> AccessibleMessage.whenAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T) =
inline fun <T> Message.whenAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T) =
asAnonymousGroupContentMessageImpl()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent>? =
inline fun Message.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent>? =
this as? AnonymousGroupContentMessageImpl<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent> =
inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent> =
this as AnonymousGroupContentMessageImpl<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenChannelContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T) =
inline fun <T> Message.whenChannelContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T) =
asChannelContentMessageImpl()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? =
inline fun Message.asChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? =
this as? UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent> =
inline fun Message.requireChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent> =
this as UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenPassportMessage(block: (PassportMessage) -> T) = asPassportMessage()?.let(block)
inline fun <T> Message.whenPassportMessage(block: (PassportMessage) -> T) = asPassportMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPassportMessage(): PassportMessage? = this as? PassportMessage
inline fun Message.asPassportMessage(): PassportMessage? = this as? PassportMessage
@PreviewFeature
inline fun AccessibleMessage.requirePassportMessage(): PassportMessage = this as PassportMessage
inline fun Message.requirePassportMessage(): PassportMessage = this as PassportMessage
@PreviewFeature
inline fun <T> AccessibleMessage.whenPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T) =
inline fun <T> Message.whenPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T) =
asPrivateContentMessageImpl()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent>? =
inline fun Message.asPrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent>? =
this as? PrivateContentMessageImpl<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requirePrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent> =
inline fun Message.requirePrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent> =
this as PrivateContentMessageImpl<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenChannelEventMessage(block: (ChannelEventMessage<ChannelEvent>) -> T) =
inline fun <T> Message.whenChannelEventMessage(block: (ChannelEventMessage<ChannelEvent>) -> T) =
asChannelEventMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asChannelEventMessage(): ChannelEventMessage<ChannelEvent>? =
inline fun Message.asChannelEventMessage(): ChannelEventMessage<ChannelEvent>? =
this as? ChannelEventMessage<ChannelEvent>
@PreviewFeature
inline fun AccessibleMessage.requireChannelEventMessage(): ChannelEventMessage<ChannelEvent> =
inline fun Message.requireChannelEventMessage(): ChannelEventMessage<ChannelEvent> =
this as ChannelEventMessage<ChannelEvent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T) =
inline fun <T> Message.whenCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T) =
asCommonGroupEventMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent>? =
inline fun Message.asCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent>? =
this as? CommonGroupEventMessage<GroupEvent>
@PreviewFeature
inline fun AccessibleMessage.requireCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent> =
inline fun Message.requireCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent> =
this as CommonGroupEventMessage<GroupEvent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T) =
inline fun <T> Message.whenCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T) =
asCommonSupergroupEventMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent>? =
inline fun Message.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent>? =
this as? CommonSupergroupEventMessage<SupergroupEvent>
@PreviewFeature
inline fun AccessibleMessage.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent> =
inline fun Message.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent> =
this as CommonSupergroupEventMessage<SupergroupEvent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenAnonymousGroupContentMessage(block: (AnonymousGroupContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenAnonymousGroupContentMessage(block: (AnonymousGroupContentMessage<MessageContent>) -> T) =
asAnonymousGroupContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent>? =
inline fun Message.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent>? =
this as? AnonymousGroupContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent> =
inline fun Message.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent> =
this as AnonymousGroupContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenChannelContentMessage(block: (ChannelContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenChannelContentMessage(block: (ChannelContentMessage<MessageContent>) -> T) =
asChannelContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asChannelContentMessage(): ChannelContentMessage<MessageContent>? =
inline fun Message.asChannelContentMessage(): ChannelContentMessage<MessageContent>? =
this as? ChannelContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireChannelContentMessage(): ChannelContentMessage<MessageContent> =
inline fun Message.requireChannelContentMessage(): ChannelContentMessage<MessageContent> =
this as ChannelContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
asConnectedFromChannelGroupContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent>? =
inline fun Message.asConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent>? =
this as? ConnectedFromChannelGroupContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent> =
inline fun Message.requireConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent> =
this as ConnectedFromChannelGroupContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
asUnconnectedFromChannelGroupContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent>? =
inline fun Message.asUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent>? =
this as? UnconnectedFromChannelGroupContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent> =
inline fun Message.requireUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent> =
this as UnconnectedFromChannelGroupContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) =
inline fun <T> Message.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) =
asChatEventMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asChatEventMessage(): ChatEventMessage<ChatEvent>? = this as? ChatEventMessage<ChatEvent>
inline fun Message.asChatEventMessage(): ChatEventMessage<ChatEvent>? = this as? ChatEventMessage<ChatEvent>
@PreviewFeature
inline fun AccessibleMessage.requireChatEventMessage(): ChatEventMessage<ChatEvent> = this as ChatEventMessage<ChatEvent>
inline fun Message.requireChatEventMessage(): ChatEventMessage<ChatEvent> = this as ChatEventMessage<ChatEvent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T) =
asCommonGroupContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent>? =
inline fun Message.asCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent>? =
this as? CommonGroupContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent> =
inline fun Message.requireCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent> =
this as CommonGroupContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenCommonMessage(block: (CommonMessage<MessageContent>) -> T) = asCommonMessage()?.let(block)
inline fun <T> Message.whenCommonMessage(block: (CommonMessage<MessageContent>) -> T) = asCommonMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asCommonMessage(): CommonMessage<MessageContent>? = this as? CommonMessage<MessageContent>
inline fun Message.asCommonMessage(): CommonMessage<MessageContent>? = this as? CommonMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireCommonMessage(): CommonMessage<MessageContent> = this as CommonMessage<MessageContent>
inline fun Message.requireCommonMessage(): CommonMessage<MessageContent> = this as CommonMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenContentMessage(block: (ContentMessage<MessageContent>) -> T) = asContentMessage()?.let(block)
inline fun <T> Message.whenContentMessage(block: (ContentMessage<MessageContent>) -> T) = asContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asContentMessage(): ContentMessage<MessageContent>? = this as? ContentMessage<MessageContent>
inline fun Message.asContentMessage(): ContentMessage<MessageContent>? = this as? ContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireContentMessage(): ContentMessage<MessageContent> = this as ContentMessage<MessageContent>
inline fun Message.requireContentMessage(): ContentMessage<MessageContent> = this as ContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenFromChannelGroupContentMessage(block: (FromChannelGroupContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenFromChannelGroupContentMessage(block: (FromChannelGroupContentMessage<MessageContent>) -> T) =
asFromChannelGroupContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent>? =
inline fun Message.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent>? =
this as? FromChannelGroupContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent> =
inline fun Message.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent> =
this as FromChannelGroupContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T) =
inline fun <T> Message.whenGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T) =
asGroupEventMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asGroupEventMessage(): GroupEventMessage<GroupEvent>? = this as? GroupEventMessage<GroupEvent>
inline fun Message.asGroupEventMessage(): GroupEventMessage<GroupEvent>? = this as? GroupEventMessage<GroupEvent>
@PreviewFeature
inline fun AccessibleMessage.requireGroupEventMessage(): GroupEventMessage<GroupEvent> = this as GroupEventMessage<GroupEvent>
inline fun Message.requireGroupEventMessage(): GroupEventMessage<GroupEvent> = this as GroupEventMessage<GroupEvent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenPrivateEventMessage(block: (PrivateEventMessage<PrivateEvent>) -> T) =
inline fun <T> Message.whenPrivateEventMessage(block: (PrivateEventMessage<PrivateEvent>) -> T) =
asPrivateEventMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPrivateEventMessage(): PrivateEventMessage<PrivateEvent>? =
inline fun Message.asPrivateEventMessage(): PrivateEventMessage<PrivateEvent>? =
this as? PrivateEventMessage<PrivateEvent>
@PreviewFeature
inline fun AccessibleMessage.requirePrivateEventMessage(): PrivateEventMessage<PrivateEvent> =
inline fun Message.requirePrivateEventMessage(): PrivateEventMessage<PrivateEvent> =
this as PrivateEventMessage<PrivateEvent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T) =
asGroupContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asGroupContentMessage(): GroupContentMessage<MessageContent>? =
inline fun Message.asGroupContentMessage(): GroupContentMessage<MessageContent>? =
this as? GroupContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requireGroupContentMessage(): GroupContentMessage<MessageContent> =
inline fun Message.requireGroupContentMessage(): GroupContentMessage<MessageContent> =
this as GroupContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenMediaGroupMessage(block: (MediaGroupMessage<MediaGroupPartContent>) -> T) =
inline fun <T> Message.whenMediaGroupMessage(block: (MediaGroupMessage<MediaGroupPartContent>) -> T) =
asMediaGroupMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent>? =
inline fun Message.asMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent>? =
this as? MediaGroupMessage<MediaGroupPartContent>
@PreviewFeature
inline fun AccessibleMessage.requireMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent> =
inline fun Message.requireMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent> =
this as MediaGroupMessage<MediaGroupPartContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenPossiblyEditedMessage(block: (PossiblyEditedMessage) -> T) =
inline fun <T> Message.whenPossiblyEditedMessage(block: (PossiblyEditedMessage) -> T) =
asPossiblyEditedMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as? PossiblyEditedMessage
inline fun Message.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as? PossiblyEditedMessage
@PreviewFeature
inline fun AccessibleMessage.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
inline fun Message.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
@PreviewFeature
inline fun <T> AccessibleMessage.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) =
inline fun <T> Message.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) =
asPossiblyReplyMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
inline fun Message.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
@PreviewFeature
inline fun AccessibleMessage.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
inline fun Message.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
@PreviewFeature
inline fun <T> AccessibleMessage.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) =
inline fun <T> Message.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) =
asPossiblyForwardedMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPossiblyForwardedMessage(): PossiblyForwardedMessage? = this as? PossiblyForwardedMessage
inline fun Message.asPossiblyForwardedMessage(): PossiblyForwardedMessage? = this as? PossiblyForwardedMessage
@PreviewFeature
inline fun AccessibleMessage.requirePossiblyForwardedMessage(): PossiblyForwardedMessage = this as PossiblyForwardedMessage
inline fun Message.requirePossiblyForwardedMessage(): PossiblyForwardedMessage = this as PossiblyForwardedMessage
@PreviewFeature
inline fun <T> AccessibleMessage.whenPossiblyPaymentMessage(block: (PossiblyPaymentMessage) -> T) =
inline fun <T> Message.whenPossiblyPaymentMessage(block: (PossiblyPaymentMessage) -> T) =
asPossiblyPaymentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as? PossiblyPaymentMessage
inline fun Message.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as? PossiblyPaymentMessage
@PreviewFeature
inline fun AccessibleMessage.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage
inline fun Message.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage
@PreviewFeature
inline fun <T> AccessibleMessage.whenPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T) =
asPrivateContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPrivateContentMessage(): PrivateContentMessage<MessageContent>? =
inline fun Message.asPrivateContentMessage(): PrivateContentMessage<MessageContent>? =
this as? PrivateContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requirePrivateContentMessage(): PrivateContentMessage<MessageContent> =
inline fun Message.requirePrivateContentMessage(): PrivateContentMessage<MessageContent> =
this as PrivateContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenPublicContentMessage(block: (PublicContentMessage<MessageContent>) -> T) =
inline fun <T> Message.whenPublicContentMessage(block: (PublicContentMessage<MessageContent>) -> T) =
asPublicContentMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPublicContentMessage(): PublicContentMessage<MessageContent>? =
inline fun Message.asPublicContentMessage(): PublicContentMessage<MessageContent>? =
this as? PublicContentMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requirePublicContentMessage(): PublicContentMessage<MessageContent> =
inline fun Message.requirePublicContentMessage(): PublicContentMessage<MessageContent> =
this as PublicContentMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenSignedMessage(block: (SignedMessage) -> T) = asSignedMessage()?.let(block)
inline fun <T> Message.whenSignedMessage(block: (SignedMessage) -> T) = asSignedMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asSignedMessage(): SignedMessage? = this as? SignedMessage
inline fun Message.asSignedMessage(): SignedMessage? = this as? SignedMessage
@PreviewFeature
inline fun AccessibleMessage.requireSignedMessage(): SignedMessage = this as SignedMessage
inline fun Message.requireSignedMessage(): SignedMessage = this as SignedMessage
@PreviewFeature
inline fun <T> AccessibleMessage.whenSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T) =
inline fun <T> Message.whenSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T) =
asSupergroupEventMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent>? =
inline fun Message.asSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent>? =
this as? SupergroupEventMessage<SupergroupEvent>
@PreviewFeature
inline fun AccessibleMessage.requireSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent> =
inline fun Message.requireSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent> =
this as SupergroupEventMessage<SupergroupEvent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenUnknownMessageType(block: (UnknownMessageType) -> T) = asUnknownMessageType()?.let(block)
inline fun <T> Message.whenUnknownMessageType(block: (UnknownMessageType) -> T) = asUnknownMessageType()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asUnknownMessageType(): UnknownMessageType? = this as? UnknownMessageType
inline fun Message.asUnknownMessageType(): UnknownMessageType? = this as? UnknownMessageType
@PreviewFeature
inline fun AccessibleMessage.requireUnknownMessageType(): UnknownMessageType = this as UnknownMessageType
inline fun Message.requireUnknownMessageType(): UnknownMessageType = this as UnknownMessageType
@PreviewFeature
inline fun <T> AccessibleMessage.whenPossiblySentViaBotCommonMessage(block: (PossiblySentViaBotCommonMessage<MessageContent>) -> T) =
inline fun <T> Message.whenPossiblySentViaBotCommonMessage(block: (PossiblySentViaBotCommonMessage<MessageContent>) -> T) =
asPossiblySentViaBotCommonMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent>? =
inline fun Message.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent>? =
this as? PossiblySentViaBotCommonMessage<MessageContent>
@PreviewFeature
inline fun AccessibleMessage.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent> =
inline fun Message.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent> =
this as PossiblySentViaBotCommonMessage<MessageContent>
@PreviewFeature
inline fun <T> AccessibleMessage.whenFromUserMessage(block: (FromUserMessage) -> T) = asFromUserMessage()?.let(block)
inline fun <T> Message.whenFromUserMessage(block: (FromUserMessage) -> T) = asFromUserMessage()?.let(block)
@PreviewFeature
inline fun AccessibleMessage.asFromUserMessage(): FromUserMessage? = this as? FromUserMessage
inline fun Message.asFromUserMessage(): FromUserMessage? = this as? FromUserMessage
@PreviewFeature
inline fun AccessibleMessage.requireFromUserMessage(): FromUserMessage = this as FromUserMessage
inline fun Message.requireFromUserMessage(): FromUserMessage = this as FromUserMessage
@PreviewFeature
inline fun <T> BotAction.whenFindLocationAction(block: (FindLocationAction) -> T) = asFindLocationAction()?.let(block)

View File

@ -23,58 +23,58 @@ import dev.inmo.tgbotapi.types.venue.Venue
import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.from: User?
inline val Message.from: User?
get() = asFromUser() ?.from
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.sender_chat: PublicChat?
inline val Message.sender_chat: PublicChat?
get() = asFromChannelGroupContentMessage() ?.senderChat
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.forward_from: User?
inline val Message.forward_from: User?
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asUserForwardInfo() ?.from
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.forward_from_chat: Chat?
inline val Message.forward_from_chat: Chat?
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asForwardFromPublicChatInfo() ?.chat
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.forward_from_message_id: MessageId?
inline val Message.forward_from_message_id: MessageId?
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.fromChannelOrNull() ?.messageId
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.forward_signature: ForwardSignature?
inline val Message.forward_signature: ForwardSignature?
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.fromChannelOrNull() ?.signature
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.forward_sender_name: ForwardSenderName?
inline val Message.forward_sender_name: ForwardSenderName?
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asAnonymousForwardInfo() ?.senderName
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.forward_date: TelegramDate?
inline val Message.forward_date: TelegramDate?
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.dateOfOriginal
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.is_automatic_forward: Boolean?
inline val Message.is_automatic_forward: Boolean?
get() = this is ConnectedFromChannelGroupContentMessage<*>
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.reply_to_message: Message?
inline val Message.reply_to_message: Message?
get() = asPossiblyReplyMessage() ?.replyTo
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.via_bot: CommonBot?
inline val Message.via_bot: CommonBot?
get() = asPossiblySentViaBotCommonMessage() ?.senderBot
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.edit_date: TelegramDate?
inline val Message.edit_date: TelegramDate?
get() = asPossiblyEditedMessage() ?.editDate ?.toTelegramDate()
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.has_protected_content: Boolean?
inline val Message.has_protected_content: Boolean?
get() = asContentMessage() ?.hasProtectedContent
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.media_group_id: MediaGroupIdentifier?
inline val Message.media_group_id: MediaGroupIdentifier?
get() = asMediaGroupMessage() ?.mediaGroupId
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.author_signature: AuthorSignature?
inline val Message.author_signature: AuthorSignature?
get() = asSignedMessage() ?.authorSignature
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.text: String?
inline val Message.text: String?
get() = asContentMessage() ?.content ?.asTextContent() ?.text
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.entities: TextSourcesList?
inline val Message.entities: TextSourcesList?
get() = asContentMessage() ?.content ?.asTextContent() ?.textSources
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.caption: String?
inline val Message.caption: String?
get() = whenContentMessage {
if (it.content !is TextContent) {
it.content.asTextedInput() ?.text
@ -83,7 +83,7 @@ inline val AccessibleMessage.caption: String?
}
}
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.caption_entities: TextSourcesList?
inline val Message.caption_entities: TextSourcesList?
get() = whenContentMessage {
if (it.content !is TextContent) {
it.content.asTextedInput() ?.textSources
@ -92,117 +92,117 @@ inline val AccessibleMessage.caption_entities: TextSourcesList?
}
}
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.audio: AudioFile?
inline val Message.audio: AudioFile?
get() = asContentMessage() ?.content ?.asAudioContent() ?.media
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.document: DocumentFile?
inline val Message.document: DocumentFile?
get() = asContentMessage() ?.content ?.asDocumentContent() ?.media
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.animation: AnimationFile?
inline val Message.animation: AnimationFile?
get() = asContentMessage() ?.content ?.asAnimationContent() ?.media
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.game: Game?
inline val Message.game: Game?
get() = asContentMessage() ?.content ?.asGameContent() ?.game
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.photo: Photo?
inline val Message.photo: Photo?
get() = asContentMessage() ?.content ?.asPhotoContent() ?.mediaCollection
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.sticker: Sticker?
inline val Message.sticker: Sticker?
get() = asContentMessage() ?.content ?.asStickerContent() ?.media
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.video: VideoFile?
inline val Message.video: VideoFile?
get() = asContentMessage() ?.content ?.asVideoContent() ?.media
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.voice: VoiceFile?
inline val Message.voice: VoiceFile?
get() = asContentMessage() ?.content ?.asVoiceContent() ?.media
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.video_note: VideoNoteFile?
inline val Message.video_note: VideoNoteFile?
get() = asContentMessage() ?.content ?.asVideoNoteContent() ?.media
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.contact: Contact?
inline val Message.contact: Contact?
get() = asContentMessage() ?.content ?.asContactContent() ?.contact
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.location: Location?
inline val Message.location: Location?
get() = asContentMessage() ?.content ?.asLocationContent() ?.location
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.venue: Venue?
inline val Message.venue: Venue?
get() = asContentMessage() ?.content ?.asVenueContent() ?.venue
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.poll: Poll?
inline val Message.poll: Poll?
get() = asContentMessage() ?.content ?.asPollContent() ?.poll
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.invoice: Invoice?
inline val Message.invoice: Invoice?
get() = asContentMessage() ?.content ?.asInvoiceContent() ?.invoice
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.dice: Dice?
inline val Message.dice: Dice?
get() = asContentMessage() ?.content ?.asDiceContent() ?.dice
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.new_chat_members: List<User>?
inline val Message.new_chat_members: List<User>?
get() = asChatEventMessage() ?.chatEvent ?.asNewChatMembers() ?.members
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.left_chat_member: User?
inline val Message.left_chat_member: User?
get() = asChatEventMessage() ?.chatEvent ?.asLeftChatMember() ?.user
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.new_chat_title: String?
inline val Message.new_chat_title: String?
get() = asChatEventMessage() ?.chatEvent ?.asNewChatTitle() ?.title
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.new_chat_photo: Photo?
inline val Message.new_chat_photo: Photo?
get() = asChatEventMessage() ?.chatEvent ?.asNewChatPhoto() ?.photo
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.delete_chat_photo: Boolean
inline val Message.delete_chat_photo: Boolean
get() = asChatEventMessage() ?.chatEvent is DeleteChatPhoto
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.group_chat_created: Boolean
inline val Message.group_chat_created: Boolean
get() = asChatEventMessage() ?.chatEvent is GroupChatCreated
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.supergroup_chat_created: Boolean
inline val Message.supergroup_chat_created: Boolean
get() = asChatEventMessage() ?.chatEvent is SupergroupChatCreated
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.channel_chat_created: Boolean
inline val Message.channel_chat_created: Boolean
get() = asChatEventMessage() ?.chatEvent is ChannelChatCreated
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.migrate_to_chat_id: IdChatIdentifier?
inline val Message.migrate_to_chat_id: IdChatIdentifier?
get() = asChatEventMessage() ?.chatEvent ?.asGroupChatCreated() ?.migratedTo
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.migrate_from_chat_id: IdChatIdentifier?
inline val Message.migrate_from_chat_id: IdChatIdentifier?
get() = asChatEventMessage() ?.chatEvent ?.let {
it ?.asSupergroupChatCreated() ?.migratedFrom ?: it ?.asMigratedToSupergroup() ?.migratedFrom
}
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.pinned_message: Message?
inline val Message.pinned_message: Message?
get() = asChatEventMessage() ?.chatEvent ?.asPinnedMessage() ?.message
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.successful_payment: SuccessfulPayment?
inline val Message.successful_payment: SuccessfulPayment?
get() = asChatEventMessage() ?.chatEvent ?.asSuccessfulPaymentEvent() ?.payment
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.video_chat_scheduled: VideoChatScheduled?
inline val Message.video_chat_scheduled: VideoChatScheduled?
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatScheduled()
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.video_chat_started: VideoChatStarted?
inline val Message.video_chat_started: VideoChatStarted?
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatStarted()
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.video_chat_ended: VideoChatEnded?
inline val Message.video_chat_ended: VideoChatEnded?
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatEnded()
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.video_chat_participants_invited: VideoChatParticipantsInvited?
inline val Message.video_chat_participants_invited: VideoChatParticipantsInvited?
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatParticipantsInvited()
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged?
inline val Message.message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged?
get() = asChatEventMessage() ?.chatEvent ?.asMessageAutoDeleteTimerChanged()
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.connected_website: String?
inline val Message.connected_website: String?
get() = asChatEventMessage() ?.chatEvent ?.asUserLoggedIn() ?.domain
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.proximity_alert_triggered: ProximityAlertTriggered?
inline val Message.proximity_alert_triggered: ProximityAlertTriggered?
get() = asChatEventMessage() ?.chatEvent ?.asProximityAlertTriggered()
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.passport_data: PassportData?
inline val Message.passport_data: PassportData?
get() = asPassportMessage() ?.passportData
@RiskFeature(RawFieldsUsageWarning)
inline val AccessibleMessage.reply_markup: InlineKeyboardMarkup?
inline val Message.reply_markup: InlineKeyboardMarkup?
get() = asCommonMessage() ?.replyMarkup