1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-06-22 11:15:11 +00:00

Compare commits

..

24 Commits

Author SHA1 Message Date
df5018ecf5 Make ChatJoinRequestQueryResult inheritors data objects + serializable
- Approve/Decline/Queue are now data object
- each inheritor (and Unknown) annotated with the shared
  ChatJoinRequestQueryResult.Companion serializer
- companion PrimitiveSerialDescriptor serial name is "ChatJoinRequestQueryResult"

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 18:49:42 +06:00
0188c65319 Rework ChatJoinRequestQueryResult + EditChatMessageText nullable text
- ChatJoinRequestQueryResult: enum -> sealed interface (Approve/Decline/
  Queue objects + Unknown) with a companion KSerializer using a
  PrimitiveKind.STRING descriptor (encodeString/decodeString), not
  String.serializer()
- EditChatMessageText: text is now nullable per API; add EditChatMessageRichText
  factory for rich edits; widen EditTextChatMessage.text to String?

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 18:42:25 +06:00
c2b1a5d44b Add behaviour-builder coverage for receiving Rich Messages
- onRichMessage trigger (ContentTriggers)
- waitRichMessage / waitRichMessageMessage expectations
- Flow<ContentMessage<*>>.onlyRichMessageContentMessages() util

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 17:52:10 +06:00
6bdd217530 Add Bot API 10.1 Rich Messages support
Adds the full Rich Messages type system and methods:
- RichText hierarchy: RichTextPlain, RichTextGroup, RichTextEntity and all
  24 RichText* entity types, with a recursive serializer handling plain
  strings, arrays and typed objects
- RichBlock hierarchy: all 21 RichBlock* types plus RichBlockCaption,
  RichBlockTableCell and RichBlockListItem (JsonContentPolymorphic by type)
- RichMessage type and RichMessageContent message content; rich_message
  parsed in RawMessage; RichMessageContentMessage typealias
- InputRichMessage (internal constructor + InputRichMessageHTML /
  InputRichMessageMarkdown factories) and InputRichMessageContent usable as
  InputMessageContent
- SendRichMessage and SendRichMessageDraft requests with API bindings
- richMessage parameter on EditChatMessageText
- Serialization round-trip test for RichMessage/RichText/RichBlock

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 17:32:56 +06:00
f6d5b3ea71 Add Bot API 10.1 Join Request Queries support
Adds:
- ChatJoinRequestQueryId value class and ChatJoinRequest.queryId field
- ExtendedBot.supportsJoinRequestQueries (User.supports_join_request_queries)
- ExtendedChat.guardBot (ChatFullInfo.guard_bot), parsed for public chats
- AnswerChatJoinRequestQuery request + ChatJoinRequestQueryResult enum
- SendChatJoinRequestWebApp request
- answerChatJoinRequestQuery / sendChatJoinRequestWebApp TelegramBot extensions

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 17:03:26 +06:00
628e877064 Add Bot API 10.1 Polls support (Link, InputMediaLink)
Adds the Link type implementing PollMedia (the url attached to a poll
option), parses the new `link` field in PollMedia, and adds
TelegramMediaLink (InputMediaLink) usable as InputPollOptionMedia.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 16:53:59 +06:00
8ba13ea5fc start 35.0.0 2026-06-19 16:27:54 +06:00
b8e995f36d Merge pull request #1047 from InsanusMokrassar/34.0.0
34.0.0
2026-06-13 14:34:21 +06:00
fa73f34182 Merge branch 'master' into 34.0.0 2026-06-13 14:08:47 +06:00
db0e839d2f Merge pull request #1049 from InsanusMokrassar/33.2.0
33.2.0
2026-06-13 13:54:56 +06:00
7b28c0f068 fill changelog 2026-06-13 13:54:35 +06:00
f4c50caf1e add supporting of telegram bots api note 2026-06-13 13:51:43 +06:00
7e45f84b78 small update of changelog 2026-06-13 00:24:55 +06:00
1603f4dae4 small note about migration 2026-06-06 13:17:01 +06:00
a9f27b4417 ksp + apiDump 2026-06-06 13:02:04 +06:00
b39b5f376e small improvement in message hierarchy 2026-05-30 18:56:27 +06:00
df77c65c86 rework of guest answers messages 2026-05-30 15:09:19 +06:00
1f2b3b9464 guest message answers rework 2026-05-30 12:49:54 +06:00
643133a87b add api exception (solution of #1048) + add classcasts for exceptions 2026-05-28 19:05:53 +06:00
cd56c7e257 rename functions names in NewRequestExceptionTests 2026-05-28 18:38:35 +06:00
03921092a4 Merge pull request #1042 from Dramex/fix/1008-too-many-requests-case-insensitive
Detect Too Many Requests case-insensitively (closes #1008)
2026-05-28 18:36:54 +06:00
4a09a6372e start 33.2.0 2026-05-28 18:25:55 +06:00
fdd21f3cbd fixes in guest mode 2026-05-23 00:02:16 +06:00
emad
4500711db4 Detect Too Many Requests descriptions case-insensitively
Telegram has been observed to return both "Bad Request: Too Many
Requests: retry after N" and "Bad Request: too Many Requests: retry
after N" (lowercase leading 't'). The current case-sensitive check
silently misses the latter and the caller never sees a
TooMuchRequestsException.

Added `ignoreCase = true` to the contains(...) check and three
regression tests covering canonical, lowercase-initial, and
all-lowercase casings.

Closes #1008
2026-04-19 03:24:16 +03:00
70 changed files with 8582 additions and 3387 deletions

View File

@@ -1,11 +1,55 @@
# TelegramBotAPI changelog
## 35.0.0
**THIS UPDATE CONTAINS SUPPORT OF [TELEGRAM BOTS API 10.1](https://core.telegram.org/bots/api-changelog#june-11-2026)**
* `Core`:
* (`Rich Messages`) Added `RichText` (`RichTextPlain`, `RichTextGroup`, `RichTextEntity`) hierarchy with all 24 `RichText*` entity types and a recursive serializer supporting plain strings, arrays and typed objects
* (`Rich Messages`) Added `RichBlock` hierarchy with all 21 `RichBlock*` types plus `RichBlockCaption`, `RichBlockTableCell` and `RichBlockListItem`
* (`Rich Messages`) Added `RichMessage` type and `RichMessageContent` message content; parsed `rich_message` in `RawMessage`; added `RichMessageContentMessage` typealias
* (`Rich Messages`) Added `InputRichMessage` (internal constructor with `InputRichMessageHTML`/`InputRichMessageMarkdown` factories) and `InputRichMessageContent` usable as `InputMessageContent`
* (`Rich Messages`) Added `SendRichMessage` and `SendRichMessageDraft` requests
* (`Rich Messages`) Added `richMessage` parameter to `EditChatMessageText`; its `text` is now nullable (per API) and the `EditChatMessageRichText` factory builds a rich edit; widened `EditTextChatMessage.text` to nullable
* (`Polls`) Added `Link` type (`dev.inmo.tgbotapi.types.Link`) implementing `PollMedia`, carrying the `url` of a link attached to a poll option
* (`Polls`) Added `link` field parsing to `PollMedia` deserialization/serialization
* (`Polls`) Added `TelegramMediaLink` (`InputMediaLink`) implementing `InputPollOptionMedia`, usable as a poll option media
* (`Join Request Queries`) Added `ChatJoinRequestQueryId` value class and `queryId` field to `ChatJoinRequest`
* (`Join Request Queries`) Added `supportsJoinRequestQueries` flag to `ExtendedBot` (`User.supports_join_request_queries`)
* (`Join Request Queries`) Added `guardBot` field to `ExtendedChat` (`ChatFullInfo.guard_bot`), parsed for public chats
* (`Join Request Queries`) Added `AnswerChatJoinRequestQuery` request and `ChatJoinRequestQueryResult` sealed interface (`Approve`/`Decline`/`Queue`/`Unknown`) serialized as a plain string
* (`Join Request Queries`) Added `SendChatJoinRequestWebApp` request
* `API`:
* (`Rich Messages`) Added `sendRichMessage` and `sendRichMessageDraft` `TelegramBot` extensions
* (`Join Request Queries`) Added `answerChatJoinRequestQuery` and `sendChatJoinRequestWebApp` `TelegramBot` extensions
* `BehaviourBuilder`:
* (`Rich Messages`) Added `onRichMessage` trigger and `waitRichMessage`/`waitRichMessageMessage` expectations
* `Utils`:
* (`Rich Messages`) Added `Flow<ContentMessage<*>>.onlyRichMessageContentMessages()`
* (`Join Request Queries`) Added `ChatJoinRequest.query_id` raw accessor
## 34.0.0
**THIS UPDATE CONTAINS SUPPORT OF [TELEGRAM BOTS API 10.0](https://core.telegram.org/bots/api-changelog#may-8-2026)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
**Breaking changes**:
* Removed the `CommonMessage<T>` super-type — replaced by the new sealed `ChatContentMessage<T>` (`CommonContentMessage`, `ChatMessage`); code referencing `CommonMessage` in types, `when` branches or signatures must switch to `ChatContentMessage`
* Renamed casts `commonMessageOrNull`/`commonMessageOrThrow`/`ifCommonMessage` to `chatContentMessageOrNull`/`chatContentMessageOrThrow`/`ifChatContentMessage`
* Reworked the message hierarchy (`ContentMessage`, `Message`, `FromUserMessage`, `PossiblyEditedMessage`, `PossiblyForwardedMessage`, `PossiblyPaymentMessage`, `PossiblySentViaBotCommonMessage`, `PossiblyTopicMessage`, `SignedMessage`, `ChatEventMessage`, `PassportMessage`) and related typealiases — dependent type signatures may need updates
* Chat send/reply extensions now return `ChatContentMessage<*>` (previously `ContentMessage<*>`)
* `ChatPermissions` interface gained the abstract `canReactToMessages` member — custom implementations must add it
* `SendMessageDraft` no longer throws when the text length is out of range: it now logs a warning and validates against the new `draftMessageTextLength` (`0..textLength.last`) range, allowing empty text
* `pollOptionsLimit` changed from `2..12` to `1..12`
**Migration advice**: Replace `CommonMessage` usages with `ChatContentMessage`, `commonMessageOr` with `chatContentMessageOr`
* `Core`:
* (`Guest Mode`) Added `GuestQueryId` value class and `WithOptionalGuestQueryId` interface in `dev.inmo.tgbotapi.abstracts.types`
* (`Guest Mode`) Added `GuestMessage` and `GuestContentMessage<T>` message abstractions (`SpecialMessage`, `CommonContentMessage`, `FromUserMessage`, `PossiblySentViaBot`) exposing `guestQueryId`, `guestBotCallerUser`, `guestBotCallerChat`
* (`Guest Mode`) Added `GuestContentMessageImpl` data class implementing `GuestContentMessage`
* (`Guest Mode`) Added `GuestQueryId` value class in `dev.inmo.tgbotapi.types` and `WithOptionalGuestQueryId` interface in `dev.inmo.tgbotapi.abstracts.types`
* (`Guest Mode`) Added `RequestGuestMessage` and `RequestGuestContentMessage<T>` message abstractions (`CommonContentMessage`, `SpecialMessage`, `FromUserMessage`, `PossiblySentViaBot`) exposing `guestQueryId`; added `PossiblyGuestAnswerMessage` exposing `guestBotCallerUser` and `guestBotCallerChat`
* (`Guest Mode`) Added `RequestGuestContentMessageImpl` data class implementing `RequestGuestContentMessage`
* (`Guest Mode`) Added `SentGuestMessage` carrying `InlineMessageId`
* (`Guest Mode`) Added `GuestMessageUpdate` (`BaseSentMessageUpdate`) and `guest_message` update type wiring in `RawUpdate`/`UpdateTypes`/`FlowsUpdatesFilter`
* (`Guest Mode`) Added `AnswerGuestQuery` request returning `SentGuestMessage`
@@ -25,7 +69,7 @@
* (`Chat Management`) Added optional `retrieveOtherBots` parameter to `GetChatAdministrators` request
* (`Chat Management`) Added `DeleteMessageReaction` request with `@Warning` on primary constructor; added `DeleteUserMessageReaction` and `DeleteActorChatMessageReaction` factory functions
* (`Chat Management`) Added `DeleteAllMessageReactions` request with `@Warning` on primary constructor; added `DeleteAllUserMessageReactions` and `DeleteAllActorChatMessageReactions` factory functions
* (`Polls`) Added `InputMediaSticker`, `InputMediaLocation` and `InputMediaVenue` classes
* (`Polls`) Added `TelegramMediaSticker`, `TelegramMediaLocation` and `TelegramMediaVenue` classes
* (`Polls`) Added `InputPollMedia` and `InputPollOptionMedia` sealed interfaces representing input media variants accepted by `sendPoll`
* (`Polls`) Added `PollMedia` class representing media attached to polls in incoming updates
* (`Polls`) Added `media` field to `Poll`, `PollOption` and `InputPollOption`
@@ -37,10 +81,10 @@
* (`Polls`) Decreased minimum allowed poll options count from 2 to 1 (`pollOptionsLimit` is now `1..12`)
* (`Managed Bots Access`) Added `BotAccessSettings` data class in `dev.inmo.tgbotapi.types.managed_bots` with `isAccessRestricted` and `addedUsers` fields
* (`Managed Bots Access`) Added `GetManagedBotAccessSettings` request returning `BotAccessSettings`
* (`Managed Bots Access`) Added `SetManagedBotAccessSettings` request with `isAccessRestricted` and optional `addedUserIds`
* (`Managed Bots Access`) Added `SetManagedBotAccessSettings` request with `userId` and optional `addedUserIds` (`isAccessRestricted` is derived from `addedUserIds`)
* (`Managed Bots Access`) Added `isAccessRestrictedField`, `addedUsersField`, `addedUserIdsField` constants
* (`Personal Chat`) Added `GetUserPersonalChatMessages` request returning `List<ContentMessage<*>>`
* (`Drafts`) `SendMessageDraft.text` and matching factory `text` parameter became nullable to allow empty/absent text (renders "Thinking…" placeholder)
* (`Personal Chat`) Added `GetUserPersonalChatMessages` request returning `List<ChatContentMessage<*>>`
* (`Drafts`) `SendMessageDraft` now allows empty text via the new `draftMessageTextLength` (`0..textLength.last`) range and logs a warning instead of throwing when the text length is out of range
* `API`:
* (`Guest Mode`) Added `answerGuestQuery` extensions in `dev.inmo.tgbotapi.extensions.api.answers`
* (`Guest Mode`) Added `RepliesWithGuestQueryId.kt` reply extensions accepting `GuestQueryId`
@@ -53,19 +97,24 @@
* (`Polls`) Added `media`, `membersOnly`, `countryCodes` parameters to `sendRegularPoll` extension
* (`Polls`) Added `media`, `explanationMedia`, `membersOnly`, `countryCodes` parameters to `sendQuizPoll` extension
* (`Managed Bots Access`) Added `getManagedBotAccessSettings` extension in `dev.inmo.tgbotapi.extensions.api.managed_bots`
* (`Managed Bots Access`) Added `setManagedBotAccessSettings` extension with `userId`, `isAccessRestricted`, optional `addedUserIds`
* (`Personal Chat`) Added `getUserPersonalChatMessages` extension returning `List<ChatContentMessage<*>>`
* (`Drafts`) `sendMessageDraft` and `send` overloads for drafts now accept nullable `text: String?`
* (`Managed Bots Access`) Added `setManagedBotAccessSettings` extension with `userId` and optional `addedUserIds`
* (`Personal Chat`) Added `getUserPersonalChatMessages` extension returning `List<ContentMessage<*>>`
* `Behaviour Builder`:
* (`Guest Mode`) Added `GuestMessageTriggers` with `onGuestMessage` trigger
* (`Guest Mode`) Added `GuestMessageTriggers` with `onGuestRequestMessage` trigger
* (`Guest Mode`) Updated `WaitContent`, `WaitContentMessage`, `WaitEditedContentMessage`, `WaitMediaGroup`, `WaitMediaGroupMessages`, `WaitCommandsMessages`, `WaitDeepLinks`, `WaitMention`, `WaitMentionMessage`, `ContentTriggers`, `EditedContentTriggers`, `MediaGroupMessagesTriggers`, `MediaGroupTriggers`, `MentionTriggers`, `DeepLinkHandling`, `MessageFilterExcludingMediaGroups` for the unified `ChatContentMessage` hierarchy
* (`Live Photos`) Added `onLivePhoto`, `onEditedLivePhoto`, `onLivePhotoGalleryMessages`, `onLivePhotoGallery` triggers
* (`Live Photos`) Added `onMentionWithLivePhotoContent`/`onTextMentionWithLivePhotoContent` triggers
* (`Live Photos`) Added `waitLivePhoto`, `waitLivePhotoMessage`, `waitEditedLivePhoto`, `waitEditedLivePhotoMessage`, `waitLivePhotoGallery`, `waitLivePhotoGalleryMessages` expectations
* (`Live Photos`) Added `onlyLivePhotoContentMessages` utility
* `Utils`:
* (`Guest Mode`) Added `guestMessageUpdateOrNull` and related casts in `ClassCastsNew`/`ClassCasts`/`ContentCastsNew`/`WithContent`/`CommonMessageConversations`
* (`Guest Mode`) Updated `MessageFilters`, `SentMessageUpdatesConversations`, `LongPolling`, `MediaGroupContentMessageCreator`, `FlowsUpdatesFilter` shortcuts to support guest messages
* (`Guest Mode`) Added `guestMessageUpdateOrNull` and related casts in `ClassCastsNew`
* (`Guest Mode`) Updated `MediaGroupContentMessageCreator` and `FlowsUpdatesFilter` to support guest messages
## 33.2.0
* `Core`:
* Add `ApiException` as variant of `BotException`
* Add classcasts for bots exceptions
## 33.1.0

View File

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-9.6-blue)](https://core.telegram.org/bots/api-changelog#april-3-2026)
# TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-10.0-blue)](https://core.telegram.org/bots/api-changelog#may-8-2026)
| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|

View File

@@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true
library_group=dev.inmo
library_version=34.0.0
library_version=35.0.0

View File

@@ -562,6 +562,12 @@ public final class dev/inmo/tgbotapi/extensions/api/chat/get/GetForumTopicIconSt
public static final fun getForumTopicIconStickers (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/chat/invite_links/AnswerChatJoinRequestQueryKt {
public static final fun answerChatJoinRequestQuery (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/ChatJoinRequest;Ldev/inmo/tgbotapi/requests/chat/invite_links/ChatJoinRequestQueryResult;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun answerChatJoinRequestQuery (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/update/ChatJoinRequestUpdate;Ldev/inmo/tgbotapi/requests/chat/invite_links/ChatJoinRequestQueryResult;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun answerChatJoinRequestQuery-Vwi-J50 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/chat/invite_links/ChatJoinRequestQueryResult;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/chat/invite_links/ApproveChatJoinRequestKt {
public static final fun approve (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/ChatJoinRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun approveChatJoinRequest (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -687,6 +693,12 @@ public final class dev/inmo/tgbotapi/extensions/api/chat/invite_links/RevokeChat
public static final fun revokeChatInviteLink (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/PublicChat;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/chat/invite_links/SendChatJoinRequestWebAppKt {
public static final fun sendChatJoinRequestWebApp (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/ChatJoinRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendChatJoinRequestWebApp (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/update/ChatJoinRequestUpdate;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendChatJoinRequestWebApp-Vwi-J50 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/chat/members/BanChatMemberKt {
public static final fun banChatMember (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ldev/inmo/tgbotapi/types/TelegramDate;Ljava/lang/Boolean;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun banChatMember (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/TelegramDate;Ljava/lang/Boolean;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -1730,7 +1742,7 @@ public final class dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMess
}
public final class dev/inmo/tgbotapi/extensions/api/send/RepliesWithGuestQueryIdKt {
public static final fun reply (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/GuestMessage;Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun reply (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/RequestGuestMessage;Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/send/ResendMessageKt {
@@ -1950,6 +1962,18 @@ public final class dev/inmo/tgbotapi/extensions/api/send/SendMessageKt {
public static synthetic fun sendTextMessage-kPvWKIg$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/LinkPreviewOptions;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/send/SendRichMessageDraftKt {
public static final fun sendRichMessageDraft-tvXF6p8 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JJLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun sendRichMessageDraft-tvXF6p8$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JJLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/send/SendRichMessageKt {
public static final fun sendRichMessage-mNzvAxs (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendRichMessage-mNzvAxs (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ldev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun sendRichMessage-mNzvAxs$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun sendRichMessage-mNzvAxs$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ldev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/send/SendStaticLocationKt {
public static final fun sendLocation-Z2YO6e4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendLocation-Z2YO6e4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;

View File

@@ -0,0 +1,28 @@
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.AnswerChatJoinRequestQuery
import dev.inmo.tgbotapi.requests.chat.invite_links.ChatJoinRequestQueryResult
import dev.inmo.tgbotapi.types.ChatJoinRequestQueryId
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
public suspend fun TelegramBot.answerChatJoinRequestQuery(
chatJoinRequestQueryId: ChatJoinRequestQueryId,
result: ChatJoinRequestQueryResult
): Unit = execute(AnswerChatJoinRequestQuery(chatJoinRequestQueryId, result))
public suspend fun TelegramBot.answerChatJoinRequestQuery(
chatJoinRequest: ChatJoinRequest,
result: ChatJoinRequestQueryResult
): Unit = answerChatJoinRequestQuery(
requireNotNull(chatJoinRequest.queryId) {
"ChatJoinRequest.queryId is null, this request can't be answered with answerChatJoinRequestQuery"
},
result
)
public suspend fun TelegramBot.answerChatJoinRequestQuery(
chatJoinRequestUpdate: ChatJoinRequestUpdate,
result: ChatJoinRequestQueryResult
): Unit = answerChatJoinRequestQuery(chatJoinRequestUpdate.data, result)

View File

@@ -0,0 +1,27 @@
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.SendChatJoinRequestWebApp
import dev.inmo.tgbotapi.types.ChatJoinRequestQueryId
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
public suspend fun TelegramBot.sendChatJoinRequestWebApp(
chatJoinRequestQueryId: ChatJoinRequestQueryId,
webAppUrl: String
): Unit = execute(SendChatJoinRequestWebApp(chatJoinRequestQueryId, webAppUrl))
public suspend fun TelegramBot.sendChatJoinRequestWebApp(
chatJoinRequest: ChatJoinRequest,
webAppUrl: String
): Unit = sendChatJoinRequestWebApp(
requireNotNull(chatJoinRequest.queryId) {
"ChatJoinRequest.queryId is null, this request can't be processed with sendChatJoinRequestWebApp"
},
webAppUrl
)
public suspend fun TelegramBot.sendChatJoinRequestWebApp(
chatJoinRequestUpdate: ChatJoinRequestUpdate,
webAppUrl: String
): Unit = sendChatJoinRequestWebApp(chatJoinRequestUpdate.data, webAppUrl)

View File

@@ -4,11 +4,10 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.answers.answer
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import dev.inmo.tgbotapi.types.guest.SentGuestMessage
import dev.inmo.tgbotapi.types.message.abstracts.GuestContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.GuestMessage
import dev.inmo.tgbotapi.types.message.abstracts.RequestGuestMessage
public suspend fun TelegramBot.reply(
message: GuestMessage,
message: RequestGuestMessage,
queryResult: InlineQueryResult
): SentGuestMessage = answer(
message.guestQueryId,

View File

@@ -0,0 +1,70 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendRichMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.message.abstracts.ChatContentMessage
import dev.inmo.tgbotapi.types.message.content.RichMessageContent
import dev.inmo.tgbotapi.types.rich.InputRichMessage
public suspend fun TelegramBot.sendRichMessage(
chatId: ChatIdentifier,
richMessage: InputRichMessage,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<RichMessageContent> = execute(
SendRichMessage(
chatId = chatId,
richMessage = richMessage,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
public suspend fun TelegramBot.sendRichMessage(
chat: Chat,
richMessage: InputRichMessage,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<RichMessageContent> = sendRichMessage(
chatId = chat.id,
richMessage = richMessage,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -0,0 +1,21 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendRichMessageDraft
import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.rich.InputRichMessage
public suspend fun TelegramBot.sendRichMessageDraft(
chatId: ChatId,
draftId: Long,
richMessage: InputRichMessage,
threadId: MessageThreadId? = null
): Unit = execute(
SendRichMessageDraft(
chatId = chatId,
draftId = draftId,
richMessage = richMessage,
threadId = threadId
)
)

View File

@@ -394,6 +394,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitPhoto$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitPoll (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitPoll$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitRichMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitRichMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitStaticLocation (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitStaticLocation$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitSticker (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
@@ -467,6 +469,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitPhotoMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitPollMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitPollMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitRichMessageMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitRichMessageMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitStaticLocationMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitStaticLocationMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitStickerMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
@@ -853,6 +857,11 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitWriteAccessAllowedOtherEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitGuestRequestMessageKt {
public static final fun waitGuestRequestMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitGuestRequestMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQueryKt {
public static final fun waitAnyInlineQuery (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitAnyInlineQuery$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
@@ -1294,6 +1303,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handl
public static synthetic fun onPhoto$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onPoll (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onPoll$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onRichMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onRichMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onStaticLocation (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onStaticLocation$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onSticker (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
@@ -1513,8 +1524,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handl
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/GuestMessageTriggersKt {
public static final fun onGuestMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onGuestMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onGuestRequestMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onGuestRequestMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggersKt {

View File

@@ -66,6 +66,10 @@ fun BehaviourContext.waitStory(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContent(initRequest, errorFactory).mapContent<StoryContent>()
fun BehaviourContext.waitRichMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContent(initRequest, errorFactory).mapContent<RichMessageContent>()
fun BehaviourContext.waitVenue(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }

View File

@@ -75,6 +75,10 @@ fun BehaviourContext.waitStoryMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContentMessage(initRequest, errorFactory).mapWithContent<StoryContent>()
fun BehaviourContext.waitRichMessageMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContentMessage(initRequest, errorFactory).mapWithContent<RichMessageContent>()
fun BehaviourContext.waitVenueMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }

View File

@@ -0,0 +1,17 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.extensions.utils.guestMessageUpdateOrNull
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.message.abstracts.RequestGuestContentMessage
import kotlinx.coroutines.flow.Flow
fun BehaviourContext.waitGuestRequestMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
): Flow<RequestGuestContentMessage<*>> = expectFlow(
initRequest,
errorFactory
) {
(it.guestMessageUpdateOrNull() ?.data).let(::listOfNotNull)
}

View File

@@ -304,6 +304,33 @@ fun <BC : BehaviourContext> BC.onStory(
scenarioReceiver
)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream".
* [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for
* "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
fun <BC : BehaviourContext> BC.onRichMessage(
initialFilter: CommonMessageFilter<RichMessageContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, RichMessageContentMessage, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in RichMessageContentMessage, Any>? = ByChatMessageMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, RichMessageContentMessage>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, RichMessageContentMessage>
) = onContentMessageWithType(
initialFilter,
subcontextUpdatesFilter,
markerFactory,
additionalSubcontextInitialAction,
scenarioReceiver
)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,

View File

@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
import dev.inmo.tgbotapi.extensions.utils.guestMessageUpdateOrNull
import dev.inmo.tgbotapi.types.message.abstracts.GuestContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.RequestGuestContentMessage
import dev.inmo.tgbotapi.types.update.abstracts.Update
/**
@@ -16,12 +16,12 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update
* @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream".
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that data
*/
fun <BC : BehaviourContext> BC.onGuestMessage(
initialFilter: SimpleFilter<GuestContentMessage<*>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, GuestContentMessage<*>, Update>? = null,
markerFactory: MarkerFactory<in GuestContentMessage<*>, Any>? = ByChatMessageMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, GuestContentMessage<*>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, GuestContentMessage<*>>
fun <BC : BehaviourContext> BC.onGuestRequestMessage(
initialFilter: SimpleFilter<RequestGuestContentMessage<*>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, RequestGuestContentMessage<*>, Update>? = null,
markerFactory: MarkerFactory<in RequestGuestContentMessage<*>, Any>? = ByChatMessageMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, RequestGuestContentMessage<*>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, RequestGuestContentMessage<*>>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, additionalSubcontextInitialAction, scenarioReceiver) {
(it.guestMessageUpdateOrNull() ?.data) ?.let(::listOfNotNull)
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@ package dev.inmo.tgbotapi.bot.exceptions
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.Response
import dev.inmo.tgbotapi.types.RetryAfterError
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import kotlinx.coroutines.CopyableThrowable
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.io.IOException
@@ -22,7 +23,7 @@ fun newRequestException(
description == "Unauthorized" -> UnauthorizedException(response, plainAnswer, message, cause)
description.contains("PHOTO_INVALID_DIMENSIONS") -> InvalidPhotoDimensionsException(response, plainAnswer, message, cause)
description.contains("wrong file identifier") -> WrongFileIdentifierException(response, plainAnswer, message, cause)
description.contains("Too Many Requests") -> TooMuchRequestsException(
description.contains("Too Many Requests", ignoreCase = true) -> TooMuchRequestsException(
(response.parameters ?.error as? RetryAfterError) ?: RetryAfterError(60, DateTime.now().unixMillisLong),
response,
plainAnswer,
@@ -35,19 +36,51 @@ fun newRequestException(
message,
cause
)
response.errorCode != null -> ApiException(
response.errorCode,
plainAnswer,
response
)
else -> null
}
} ?: CommonRequestException(response, plainAnswer, message, cause)
sealed class BotException(message: String = "Something went wrong", cause: Throwable? = null) : IOException(message, cause), CopyableThrowable<BotException>
@ClassCastsIncluded
sealed class BotException(
override val message: String = "Something went wrong",
cause: Throwable? = null,
open val response: Response? = null,
open val plainAnswer: String? = null,
) : IOException(message, cause), CopyableThrowable<BotException>
class CommonBotException(message: String = "Something went wrong", cause: Throwable? = null) : BotException(message, cause) {
override fun createCopy(): BotException = CommonBotException(message!!, cause)
sealed class CommonBotException(
message: String = "Something went wrong",
cause: Throwable? = null,
response: Response? = null,
plainAnswer: String? = null,
) : BotException(message, cause, response, plainAnswer) {
class Default(message: String = "Something went wrong", cause: Throwable? = null) : CommonBotException(message, cause) {
override fun createCopy(): Default = Default(message, cause)
}
abstract override fun createCopy(): CommonBotException?
companion object {
operator fun invoke(message: String = "Something went wrong", cause: Throwable? = null) = Default(message, cause)
}
}
class ApiException(
val httpResponseCode: Int?,
val plainResponse: String,
response: Response? = null,
) :
CommonBotException("$httpResponseCode: $plainResponse", null, response, plainResponse) {
override fun createCopy(): ApiException = ApiException(httpResponseCode, plainResponse, response)
}
sealed class RequestException (
val response: Response,
val plainAnswer: String,
override val response: Response,
override val plainAnswer: String,
message: String? = null,
cause: Throwable? = null
) : BotException(

View File

@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.bot.ktor.base
import dev.inmo.kslog.common.*
import dev.inmo.micro_utils.coroutines.runCatchingLogging
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
import dev.inmo.tgbotapi.bot.exceptions.ApiException
import dev.inmo.tgbotapi.bot.exceptions.BotException
import dev.inmo.tgbotapi.bot.exceptions.CommonBotException
import dev.inmo.tgbotapi.bot.exceptions.GetUpdatesConflict
@@ -98,7 +99,15 @@ class DefaultKtorRequestsExecutor internal constructor(
)
}
exceptionResult.exceptionOrNull() ?.let {
CommonBotException(cause = e)
val prehandledException = runCatching {
when {
it is ResponseException -> ApiException(it.response.status.value, it.response.bodyAsText())
else -> null
}
}.getOrElse {
null
}
prehandledException ?: CommonBotException(cause = e)
} ?: exceptionResult.getOrThrow()
}
is CancellationException,

View File

@@ -0,0 +1,96 @@
package dev.inmo.tgbotapi.requests.chat.invite_links
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ChatJoinRequestQueryId
import dev.inmo.tgbotapi.types.chatJoinRequestQueryIdField
import dev.inmo.tgbotapi.types.resultField
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationStrategy
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
/**
* Result of an [AnswerChatJoinRequestQuery]. Serialized as a plain string.
*
* @see <a href="https://core.telegram.org/bots/api#answerchatjoinrequestquery">answerChatJoinRequestQuery</a>
*/
@Serializable(ChatJoinRequestQueryResult.Companion::class)
sealed interface ChatJoinRequestQueryResult {
val name: String
/**
* Allow the user to join the chat.
*/
@Serializable(ChatJoinRequestQueryResult.Companion::class)
data object Approve : ChatJoinRequestQueryResult {
override val name: String = "approve"
}
/**
* Disallow the user to join the chat.
*/
@Serializable(ChatJoinRequestQueryResult.Companion::class)
data object Decline : ChatJoinRequestQueryResult {
override val name: String = "decline"
}
/**
* Leave the decision to other administrators.
*/
@Serializable(ChatJoinRequestQueryResult.Companion::class)
data object Queue : ChatJoinRequestQueryResult {
override val name: String = "queue"
}
/**
* Any other result which is currently unknown to this library.
*/
@Serializable(ChatJoinRequestQueryResult.Companion::class)
data class Unknown(override val name: String) : ChatJoinRequestQueryResult
companion object : KSerializer<ChatJoinRequestQueryResult> {
override val descriptor: SerialDescriptor =
PrimitiveSerialDescriptor("ChatJoinRequestQueryResult", PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: ChatJoinRequestQueryResult) {
encoder.encodeString(value.name)
}
override fun deserialize(decoder: Decoder): ChatJoinRequestQueryResult {
return when (val name = decoder.decodeString()) {
Approve.name -> Approve
Decline.name -> Decline
Queue.name -> Queue
else -> Unknown(name)
}
}
}
}
/**
* Use this method to process a received chat join request query.
*
* @see <a href="https://core.telegram.org/bots/api#answerchatjoinrequestquery">answerChatJoinRequestQuery</a>
*/
@Serializable
data class AnswerChatJoinRequestQuery(
@SerialName(chatJoinRequestQueryIdField)
val chatJoinRequestQueryId: ChatJoinRequestQueryId,
@SerialName(resultField)
val result: ChatJoinRequestQueryResult
) : SimpleRequest<Unit> {
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
override val resultDeserializer: DeserializationStrategy<Unit>
get() = UnitFromBooleanSerializer
override fun method(): String = "answerChatJoinRequestQuery"
}

View File

@@ -0,0 +1,34 @@
package dev.inmo.tgbotapi.requests.chat.invite_links
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ChatJoinRequestQueryId
import dev.inmo.tgbotapi.types.chatJoinRequestQueryIdField
import dev.inmo.tgbotapi.types.webAppUrlField
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationStrategy
/**
* Use this method to process a received chat join request query by showing a Mini App to the user before deciding the
* outcome. Call [AnswerChatJoinRequestQuery] to resolve the join request query based on the user interaction with the
* Mini App.
*
* @see <a href="https://core.telegram.org/bots/api#sendchatjoinrequestwebapp">sendChatJoinRequestWebApp</a>
*/
@Serializable
data class SendChatJoinRequestWebApp(
@SerialName(chatJoinRequestQueryIdField)
val chatJoinRequestQueryId: ChatJoinRequestQueryId,
@SerialName(webAppUrlField)
val webAppUrl: String
) : SimpleRequest<Unit> {
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
override val resultDeserializer: DeserializationStrategy<Unit>
get() = UnitFromBooleanSerializer
override fun method(): String = "sendChatJoinRequestWebApp"
}

View File

@@ -3,5 +3,5 @@ package dev.inmo.tgbotapi.requests.edit.abstracts
import dev.inmo.tgbotapi.abstracts.TextedOutput
interface EditTextChatMessage : TextedOutput {
override val text: String
override val text: String?
}

View File

@@ -13,6 +13,7 @@ import dev.inmo.tgbotapi.types.message.RawMessageEntity
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import dev.inmo.tgbotapi.utils.extensions.makeString
import kotlinx.serialization.*
@@ -55,6 +56,24 @@ fun EditChatMessageText(
replyMarkup
)
fun EditChatMessageRichText(
chatId: ChatIdentifier,
messageId: MessageId,
richMessage: InputRichMessage,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null
) = EditChatMessageText(
chatId = chatId,
messageId = messageId,
text = null,
parseMode = null,
rawEntities = null,
businessConnectionId = businessConnectionId,
linkPreviewOptions = null,
replyMarkup = replyMarkup,
richMessage = richMessage
)
@ConsistentCopyVisibility
@Serializable
data class EditChatMessageText internal constructor(
@@ -63,7 +82,7 @@ data class EditChatMessageText internal constructor(
@SerialName(messageIdField)
override val messageId: MessageId,
@SerialName(textField)
override val text: String,
override val text: String? = null,
@SerialName(parseModeField)
override val parseMode: ParseMode? = null,
@SerialName(entitiesField)
@@ -73,10 +92,12 @@ data class EditChatMessageText internal constructor(
@SerialName(linkPreviewOptionsField)
override val linkPreviewOptions: LinkPreviewOptions? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(richMessageField)
val richMessage: InputRichMessage? = null
) : EditChatMessage<TextContent>, EditTextChatMessage, EditReplyMessage, EditLinkPreviewOptionsContainer {
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text)
text ?.let { rawEntities ?.asTextSources(it) }
}
override fun method(): String = editMessageTextMethod

View File

@@ -0,0 +1,65 @@
package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.*
import dev.inmo.tgbotapi.types.message.abstracts.ChatContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.RichMessageContent
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationStrategy
internal val RichMessageContentMessageResultDeserializer: DeserializationStrategy<ChatContentMessage<RichMessageContent>>
= TelegramBotAPIMessageDeserializationStrategyClass()
/**
* Use this method to send rich messages.
*
* @see <a href="https://core.telegram.org/bots/api#sendrichmessage">sendRichMessage</a>
*/
@Serializable
data class SendRichMessage(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(richMessageField)
val richMessage: InputRichMessage,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(messageThreadIdField)
@EncodeDefault
override val threadId: MessageThreadId? = chatId.threadId,
@OptIn(ExperimentalSerializationApi::class)
@EncodeDefault
@SerialName(directMessagesTopicIdField)
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(allowPaidBroadcastField)
override val allowPaidBroadcast: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(suggestedPostParametersField)
override val suggestedPostParameters: SuggestedPostParameters? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendContentMessageRequest<ChatContentMessage<RichMessageContent>>,
ReplyingMarkupSendMessageRequest<ChatContentMessage<RichMessageContent>> {
override fun method(): String = "sendRichMessage"
override val resultDeserializer: DeserializationStrategy<ChatContentMessage<RichMessageContent>>
get() = RichMessageContentMessageResultDeserializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -0,0 +1,51 @@
package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chatIdField
import dev.inmo.tgbotapi.types.draftIdField
import dev.inmo.tgbotapi.types.messageThreadIdField
import dev.inmo.tgbotapi.types.richMessageField
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationStrategy
/**
* Use this method to stream a partial rich message to a user while the message is being generated. The streamed draft is
* ephemeral and acts as a temporary 30-second preview - once the output is finalized, [SendRichMessage] must be called
* with the complete message to persist it in the user's chat.
*
* @see <a href="https://core.telegram.org/bots/api#sendrichmessagedraft">sendRichMessageDraft</a>
*/
@Serializable
data class SendRichMessageDraft(
@SerialName(chatIdField)
val chatId: ChatId,
/**
* Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated.
*/
@SerialName(draftIdField)
val draftId: Long,
@SerialName(richMessageField)
val richMessage: InputRichMessage,
@SerialName(messageThreadIdField)
val threadId: MessageThreadId? = null
) : SimpleRequest<Unit> {
init {
require(draftId != 0L) {
"draftId of SendRichMessageDraft must be non-zero"
}
}
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
override val resultDeserializer: DeserializationStrategy<Unit>
get() = UnitFromBooleanSerializer
override fun method(): String = "sendRichMessageDraft"
}

View File

@@ -0,0 +1,19 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
/**
* Identifier of a join request query.
*
* @see <a href="https://core.telegram.org/bots/api#chatjoinrequest">ChatJoinRequest.query_id</a>
*/
@Serializable
@JvmInline
value class ChatJoinRequestQueryId(
val string: String
) {
override fun toString(): String {
return string
}
}

View File

@@ -556,6 +556,7 @@ const val stickerField = "sticker"
const val oldStickerField = "old_sticker"
const val keywordsField = "keywords"
const val urlField = "url"
const val linkField = "link"
const val addressField = "address"
const val actionField = "action"
const val positionField = "position"
@@ -567,6 +568,45 @@ const val payloadField = "payload"
const val vcardField = "vcard"
const val resultsField = "results"
const val resultField = "result"
const val guardBotField = "guard_bot"
const val supportsJoinRequestQueriesField = "supports_join_request_queries"
const val queryIdField = "query_id"
const val chatJoinRequestQueryIdField = "chat_join_request_query_id"
const val webAppUrlField = "web_app_url"
const val richMessageField = "rich_message"
const val isRtlField = "is_rtl"
const val skipEntityDetectionField = "skip_entity_detection"
const val markdownField = "markdown"
const val htmlField = "html"
const val unixTimeField = "unix_time"
const val dateTimeFormatField = "date_time_format"
const val alternativeTextField = "alternative_text"
const val expressionField = "expression"
const val emailAddressField = "email_address"
const val hashtagField = "hashtag"
const val cashtagField = "cashtag"
const val bankCardNumberField = "bank_card_number"
const val anchorNameField = "anchor_name"
const val referenceNameField = "reference_name"
const val blocksField = "blocks"
const val itemsField = "items"
const val summaryField = "summary"
const val sizeField = "size"
const val languageField = "language"
const val creditField = "credit"
const val cellsField = "cells"
const val isHeaderField = "is_header"
const val colspanField = "colspan"
const val rowspanField = "rowspan"
const val alignField = "align"
const val valignField = "valign"
const val zoomField = "zoom"
const val voiceNoteField = "voice_note"
const val hasCheckboxField = "has_checkbox"
const val isCheckedField = "is_checked"
const val isOpenField = "is_open"
const val isBorderedField = "is_bordered"
const val isStripedField = "is_striped"
const val certificateField = "certificate"
const val questionField = "question"
const val questionEntitiesField = "question_entities"

View File

@@ -0,0 +1,17 @@
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
import dev.inmo.tgbotapi.types.richMessageField
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Represents the content of a rich message to be sent as the result of an inline query.
*
* @see <a href="https://core.telegram.org/bots/api#inputrichmessagecontent">InputRichMessageContent</a>
*/
@Serializable
data class InputRichMessageContent(
@SerialName(richMessageField)
val richMessage: InputRichMessage
) : InputMessageContent

View File

@@ -22,6 +22,7 @@ object InputMessageContentSerializer : KSerializer<InputMessageContent> {
is InputTextMessageContent -> InputTextMessageContent.serializer().serialize(encoder, value)
is InputVenueMessageContent -> InputVenueMessageContent.serializer().serialize(encoder, value)
is InputInvoiceMessageContent -> InputInvoiceMessageContent.serializer().serialize(encoder, value)
is InputRichMessageContent -> InputRichMessageContent.serializer().serialize(encoder, value)
}
}

View File

@@ -0,0 +1,16 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.types.media.PollMedia
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Represents an HTTP link.
*
* @see <a href="https://core.telegram.org/bots/api#link">Link</a>
*/
@Serializable
data class Link(
@SerialName(urlField)
val url: String
) : PollMedia

View File

@@ -24,7 +24,9 @@ data class ChatJoinRequest(
@SerialName(inviteLinkField)
val inviteLink: ChatInviteLink? = null,
@SerialName(bioField)
val bio: String? = null
val bio: String? = null,
@SerialName(queryIdField)
val queryId: ChatJoinRequestQueryId? = null
) : FromUser {
@Suppress("unused")
val dateTime: DateTime

View File

@@ -69,7 +69,9 @@ data class ExtendedChannelChatImpl(
@SerialName(maxReactionCountField)
override val maxReactionsCount: Int = 3,
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
) : ExtendedChannelChat
@Serializable
@@ -116,7 +118,9 @@ data class ExtendedGroupChatImpl(
@SerialName(paidMessageStarCountField)
override val paidMessageStarCount: Int? = null,
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
) : ExtendedGroupChat
@Serializable
@@ -316,7 +320,9 @@ data class ExtendedSupergroupChatImpl(
@SerialName(paidMessageStarCountField)
override val paidMessageStarCount: Int? = null,
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
) : ExtendedSupergroupChat
@Serializable
@@ -390,7 +396,9 @@ data class ExtendedForumChatImpl(
@SerialName(paidMessageStarCountField)
override val paidMessageStarCount: Int? = null,
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
) : ExtendedForumChat
@Serializable
@@ -467,7 +475,9 @@ data class ExtendedChannelDirectMessagesChatImpl(
@SerialName(paidMessageStarCountField)
override val paidMessageStarCount: Int? = null,
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
) : ExtendedChannelDirectMessagesChat {
@OptIn(ExperimentalSerializationApi::class)
@SerialName(isDirectMessagesField)
@@ -495,6 +505,8 @@ data class ExtendedBot(
val supportsInlineQueries: Boolean = false,
@SerialName(supportsGuestQueriesField)
val supportsGuestQueries: Boolean = false,
@SerialName(supportsJoinRequestQueriesField)
val supportsJoinRequestQueries: Boolean = false,
@SerialName(canConnectToBusinessField)
val canConnectToBusiness: Boolean = false,
@SerialName(photoField)

View File

@@ -27,6 +27,14 @@ sealed interface ExtendedChat : Chat {
val uniqueGiftColors: UniqueGiftColors?
/**
* The bot that processes join request queries in the chat. The field is only available to chat administrators.
*
* @see <a href="https://core.telegram.org/bots/api#chatfullinfo">ChatFullInfo.guard_bot</a>
*/
val guardBot: User?
get() = null
@Deprecated(
message = "Telegram Bot API v9.0 introduced the new field, `acceptedGiftTypes`, to allow granular" +
" control over which types of gifts user, bot, or chat can accept.",

View File

@@ -27,6 +27,7 @@ object InputPollOptionMediaSerializer : KSerializer<InputPollOptionMedia> {
override fun serialize(encoder: Encoder, value: InputPollOptionMedia) {
when (value) {
is TelegramMediaAnimation -> TelegramMediaAnimation.serializer().serialize(encoder, value)
is TelegramMediaLink -> TelegramMediaLink.serializer().serialize(encoder, value)
is TelegramMediaLivePhoto -> TelegramMediaLivePhoto.serializer().serialize(encoder, value)
is TelegramMediaLocation -> TelegramMediaLocation.serializer().serialize(encoder, value)
is TelegramMediaPhoto -> TelegramMediaPhoto.serializer().serialize(encoder, value)

View File

@@ -10,6 +10,8 @@ import dev.inmo.tgbotapi.types.files.LivePhotoFile
import dev.inmo.tgbotapi.types.files.PhotoFile
import dev.inmo.tgbotapi.types.files.Sticker
import dev.inmo.tgbotapi.types.files.VideoFile
import dev.inmo.tgbotapi.types.Link
import dev.inmo.tgbotapi.types.linkField
import dev.inmo.tgbotapi.types.livePhotoField
import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.locationField
@@ -36,6 +38,8 @@ interface PollMedia : BaseTelegramMediaFile {
val audio: AudioFile? = null,
@SerialName(documentField)
val document: DocumentFile? = null,
@SerialName(linkField)
val link: Link? = null,
@SerialName(livePhotoField)
val livePhoto: LivePhotoFile? = null,
@SerialName(photoField)
@@ -61,6 +65,7 @@ interface PollMedia : BaseTelegramMediaFile {
surrogate.animation != null -> surrogate.animation
surrogate.audio != null -> surrogate.audio
surrogate.document != null -> surrogate.document
surrogate.link != null -> surrogate.link
surrogate.livePhoto != null -> surrogate.livePhoto
surrogate.photo != null -> surrogate.photo
surrogate.sticker != null -> surrogate.sticker
@@ -76,6 +81,7 @@ interface PollMedia : BaseTelegramMediaFile {
animation = value as? AnimationFile,
audio = value as? AudioFile,
document = value as? DocumentFile,
link = value as? Link,
livePhoto = value as? LivePhotoFile,
photo = value as? PhotoFile,
sticker = value as? Sticker,

View File

@@ -0,0 +1,26 @@
package dev.inmo.tgbotapi.types.media
import dev.inmo.tgbotapi.types.typeField
import dev.inmo.tgbotapi.types.urlField
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Represents an HTTP link to be sent. Can be used as [InputPollOptionMedia].
*
* @see <a href="https://core.telegram.org/bots/api#inputmedialink">InputMediaLink</a>
*/
@Serializable
data class TelegramMediaLink(
@SerialName(urlField)
val url: String,
) : InputPollOptionMedia {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "link"
}
}

View File

@@ -180,6 +180,8 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
override val replyMarkup: InlineKeyboardMarkup?,
override val content: T,
override val senderBot: CommonBot?,
override val guestBotCallerUser: PreviewUser?,
override val guestBotCallerChat: PreviewChat?,
override val mediaGroupId: MediaGroupId?,
override val senderBoostsCount: Int?,
override val fromOffline: Boolean,
@@ -200,6 +202,8 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
replyMarkup: InlineKeyboardMarkup?,
content: T,
senderBot: CommonBot?,
guestBotCallerUser: PreviewUser?,
guestBotCallerChat: PreviewChat?,
mediaGroupId: MediaGroupId?,
senderBoostsCount: Int?,
fromOffline: Boolean,
@@ -216,6 +220,8 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
replyMarkup = replyMarkup,
content = content,
senderBot = senderBot,
guestBotCallerUser = guestBotCallerUser,
guestBotCallerChat = guestBotCallerChat,
mediaGroupId = mediaGroupId,
senderBoostsCount = senderBoostsCount,
fromOffline = fromOffline,
@@ -460,6 +466,8 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
override val replyMarkup: InlineKeyboardMarkup?,
override val content: T,
override val senderBot: CommonBot?,
override val guestBotCallerUser: PreviewUser?,
override val guestBotCallerChat: PreviewChat?,
override val mediaGroupId: MediaGroupId?,
override val senderBoostsCount: Int?,
override val fromOffline: Boolean,
@@ -481,6 +489,8 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
replyMarkup: InlineKeyboardMarkup?,
content: T,
senderBot: CommonBot?,
guestBotCallerUser: PreviewUser?,
guestBotCallerChat: PreviewChat?,
mediaGroupId: MediaGroupId?,
senderBoostsCount: Int?,
fromOffline: Boolean,
@@ -498,6 +508,8 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
replyMarkup = replyMarkup,
content = content,
senderBot = senderBot,
guestBotCallerUser = guestBotCallerUser,
guestBotCallerChat = guestBotCallerChat,
mediaGroupId = mediaGroupId,
senderBoostsCount = senderBoostsCount,
fromOffline = fromOffline,

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.chat.PreviewChat
import dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.ChatMessage
import dev.inmo.tgbotapi.types.message.abstracts.FromUserChatMessage
import dev.inmo.tgbotapi.types.passport.PassportData
data class PassportMessage(
@@ -15,4 +16,4 @@ data class PassportMessage(
override val from: User,
override val date: DateTime,
val passportData: PassportData
) : ChatMessage, FromUserMessage
) : FromUserChatMessage

View File

@@ -23,6 +23,8 @@ data class PrivateContentMessageImpl<T: MessageContent>(
override val replyInfo: ReplyInfo?,
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val guestBotCallerUser: PreviewUser?,
override val guestBotCallerChat: PreviewChat?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
override val effectId: EffectId?,
@@ -41,10 +43,27 @@ data class PrivateContentMessageImpl<T: MessageContent>(
replyTo: AccessibleMessage?,
replyMarkup: InlineKeyboardMarkup?,
senderBot: CommonBot?,
guestBotCallerUser: PreviewUser?,
guestBotCallerChat: PreviewChat?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
effectId: EffectId,
) : this(
messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, mediaGroupId, fromOffline, effectId
messageId = messageId,
from = from,
chat = chat,
content = content,
date = date,
editDate = editDate,
hasProtectedContent = hasProtectedContent,
forwardOrigin = forwardInfo.messageOrigin(),
replyInfo = replyTo ?.let { ReplyInfo.Internal(it) },
replyMarkup = replyMarkup,
senderBot = senderBot,
guestBotCallerUser = guestBotCallerUser,
guestBotCallerChat = guestBotCallerChat,
mediaGroupId = mediaGroupId,
fromOffline = fromOffline,
effectId = effectId
)
}

View File

@@ -27,6 +27,8 @@ data class PrivateForumContentMessageImpl<T: MessageContent>(
override val replyInfo: ReplyInfo?,
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val guestBotCallerUser: PreviewUser?,
override val guestBotCallerChat: PreviewChat?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
override val effectId: EffectId?,

View File

@@ -19,7 +19,6 @@ import dev.inmo.tgbotapi.types.giveaway.*
import dev.inmo.tgbotapi.types.message.content.GiveawayContent
import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.managed_bots.ManagedBotCreated
import dev.inmo.tgbotapi.types.managed_bots.ManagedBotUpdated
import dev.inmo.tgbotapi.types.polls.PollOptionAdded
import dev.inmo.tgbotapi.types.polls.PollOptionDeleted
import dev.inmo.tgbotapi.types.message.ChatEvents.*
@@ -51,6 +50,7 @@ import dev.inmo.tgbotapi.types.polls.Poll
import dev.inmo.tgbotapi.types.polls.PollOptionPersistentId
import dev.inmo.tgbotapi.types.request.ChatShared
import dev.inmo.tgbotapi.types.request.UsersShared
import dev.inmo.tgbotapi.types.rich.RichMessage
import dev.inmo.tgbotapi.types.stories.Story
import dev.inmo.tgbotapi.types.venue.Venue
import dev.inmo.tgbotapi.utils.isFakeTelegramUser
@@ -93,6 +93,7 @@ internal data class RawMessage(
private val caption_entities: RawMessageEntities? = null,
private val has_media_spoiler: Boolean? = null,
private val story: Story? = null,
private val rich_message: RichMessage? = null,
private val audio: AudioFile? = null,
private val document: DocumentFile? = null,
private val paid_media: PaidMediaInfo? = null,
@@ -231,6 +232,11 @@ internal data class RawMessage(
} ?: emptyList()
when {
rich_message != null -> RichMessageContent(
chat,
messageId,
rich_message
)
story != null -> StoryContent(
chat,
messageId,
@@ -457,448 +463,13 @@ internal data class RawMessage(
external_reply != null -> external_reply
else -> null
}
if (guest_query_id != null) {
GuestContentMessageImpl(
messageId = messageId,
from = checkedFrom ?: from ?: error("Was detected guest message, but owner (sender) of the message was not found"),
chat = chat,
guestQueryId = guest_query_id,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
mediaGroupId = media_group_id,
guestBotCallerUser = guest_bot_caller_user ?: error("For guest content message it is required to have user which called the bot"),
guestBotCallerChat = guest_bot_caller_chat ?: error("For guest content message it is required to have chat in that called the bot"),
fromOffline = is_from_offline,
cost = paid_star_count,
)
} else when (chat) {
is PreviewChannelDirectMessagesChat -> {
if (direct_messages_topic == null) error("direct_messages_topic must be presented for ChannelDirectMessagesChat messages")
val chatId = ChatIdWithChannelDirectMessageThreadId(
chat.id.chatId,
direct_messages_topic.threadId
)
val actualForumChat = when (chat) {
is ChannelDirectMessagesChatImpl -> chat.copy(id = chatId)
}
when (suggested_post_info) {
null -> {
when (sender_chat) {
is PreviewChannelChat -> FromChannelChannelDirectMessagesContentMessageImpl(
chat = actualForumChat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
directMessageTopic = direct_messages_topic,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
is PreviewGroupChat,
null -> CommonChannelDirectMessagesContentMessageImpl(
chat = actualForumChat,
messageId = messageId,
from = checkedFrom ?: from ?: error("It is expected that in direct channel messages from non anonymous channels user must be specified"),
date = date.asDate,
directMessageTopic = direct_messages_topic,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
cost = paid_star_count,
senderTag = sender_tag,
)
}
}
else -> {
when (sender_chat) {
is PreviewChannelChat -> FromChannelSuggestedChannelDirectMessagesContentMessageImpl(
chat = actualForumChat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
directMessageTopic = direct_messages_topic,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
suggestedPostInfo = suggested_post_info,
cost = paid_star_count,
)
is PreviewGroupChat,
null -> CommonSuggestedChannelDirectMessagesContentMessageImpl(
chat = actualForumChat,
messageId = messageId,
from = checkedFrom ?: from ?: error("It is expected that in direct channel messages from non anonymous channels user must be specified"),
date = date.asDate,
directMessageTopic = direct_messages_topic,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
suggestedPostInfo = suggested_post_info,
cost = paid_star_count,
senderTag = sender_tag,
)
}
}
}
}
is PreviewPublicChat -> when (chat) {
is PreviewChannelChat -> if (is_paid_post) {
ChannelPaidPostImpl(
messageId = messageId,
chat = chat,
senderChat = checkedFrom ?: sender_chat ?: chat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
} else {
ChannelContentMessageImpl(
messageId = messageId,
chat = chat,
senderChat = checkedFrom ?: sender_chat ?: chat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
}
is PreviewForumChat -> when(chat) {
is ForumChatImpl -> {
if (messageThreadId != null) {
val chatId = ChatIdWithThreadId(
chat.id.chatId,
messageThreadId
)
val actualForumChat = when (chat) {
is ForumChatImpl -> chat.copy(id = chatId)
}
when (sender_chat) {
is PreviewChannelChat -> FromChannelForumContentMessageImpl(
chat = actualForumChat,
channel = sender_chat,
messageId = messageId,
threadId = messageThreadId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
is PreviewGroupChat -> AnonymousForumContentMessageImpl(
chat = actualForumChat,
messageId = messageId,
threadId = messageThreadId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
null -> CommonForumContentMessageImpl(
chat = actualForumChat,
messageId = messageId,
threadId = messageThreadId,
from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
cost = paid_star_count,
senderTag = sender_tag,
)
}
} else {
when (sender_chat) {
is PreviewChannelChat -> if (is_automatic_forward == true) {
ConnectedFromChannelGroupContentMessageImpl(
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
} else {
UnconnectedFromChannelGroupContentMessageImpl(
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
}
is GroupChat -> AnonymousGroupContentMessageImpl(
chat = chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
null -> CommonGroupContentMessageImpl(
chat = chat,
messageId = messageId,
from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
cost = paid_star_count,
senderTag = sender_tag
)
}
}
}
}
is PreviewGroupChat -> when (sender_chat) {
is PreviewChannelChat -> if (is_automatic_forward == true) {
ConnectedFromChannelGroupContentMessageImpl(
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
} else {
UnconnectedFromChannelGroupContentMessageImpl(
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
}
is PreviewGroupChat -> AnonymousGroupContentMessageImpl(
chat = chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
null -> CommonGroupContentMessageImpl(
chat = chat,
messageId = messageId,
from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
cost = paid_star_count,
senderTag = sender_tag,
)
}
}
is PreviewPrivateChat -> if (business_connection_id == null) {
when {
is_topic_message == true -> {
val chatId = ChatIdWithThreadId(
chat.id.chatId,
messageThreadId ?: error("Was detected forum private message, but message thread id was not found")
)
val actualForumChat = when (chat) {
is PrivateForumChatImpl -> chat.copy(id = chatId)
is CommonUser -> chat.copy(id = chatId)
is CommonBot -> chat
is PrivateChatImpl -> PrivateForumChatImpl(
id = chatId,
username = chat.username,
firstName = chat.firstName,
lastName = chat.lastName
)
}
PrivateForumContentMessageImpl(
messageId = messageId,
from = checkedFrom ?: from ?: error("Was detected common message, but owner (sender) of the message was not found"),
threadId = messageThreadId,
threadCreatingInfo = forum_topic_created,
chat = actualForumChat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
effectId = effect_id,
cost = paid_star_count,
)
}
else -> {
PrivateContentMessageImpl(
messageId = messageId,
from = checkedFrom ?: from
?: error("Was detected common message, but owner (sender) of the message was not found"),
chat = chat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
effectId = effect_id,
cost = paid_star_count,
)
}
}
} else {
BusinessContentMessageImpl(
when {
guest_query_id != null -> {
RequestGuestContentMessageImpl(
messageId = messageId,
from = checkedFrom ?: from ?: error("Was detected common message, but owner (sender) of the message was not found"),
chat = BusinessChatImpl(
chat.id.toBusinessChatId(business_connection_id),
chat
),
businessConnectionId = business_connection_id,
from = checkedFrom ?: from ?: error("Was detected guest message, but owner (sender) of the message was not found"),
chat = chat,
guestQueryId = guest_query_id,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
@@ -908,12 +479,460 @@ internal data class RawMessage(
replyMarkup = reply_markup,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBusinessBot = sender_business_bot,
fromOffline = is_from_offline,
cost = paid_star_count,
)
}
else -> error("Unknown type of chat: $chat")
else -> {
when (chat) {
is PreviewChannelDirectMessagesChat -> {
if (direct_messages_topic == null) error("direct_messages_topic must be presented for ChannelDirectMessagesChat messages")
val chatId = ChatIdWithChannelDirectMessageThreadId(
chat.id.chatId,
direct_messages_topic.threadId
)
val actualForumChat = when (chat) {
is ChannelDirectMessagesChatImpl -> chat.copy(id = chatId)
}
when (suggested_post_info) {
null -> {
when (sender_chat) {
is PreviewChannelChat -> FromChannelChannelDirectMessagesContentMessageImpl(
chat = actualForumChat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
directMessageTopic = direct_messages_topic,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
is PreviewGroupChat,
null -> CommonChannelDirectMessagesContentMessageImpl(
chat = actualForumChat,
messageId = messageId,
from = checkedFrom ?: from ?: error("It is expected that in direct channel messages from non anonymous channels user must be specified"),
date = date.asDate,
directMessageTopic = direct_messages_topic,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
cost = paid_star_count,
senderTag = sender_tag,
)
}
}
else -> {
when (sender_chat) {
is PreviewChannelChat -> FromChannelSuggestedChannelDirectMessagesContentMessageImpl(
chat = actualForumChat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
directMessageTopic = direct_messages_topic,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
suggestedPostInfo = suggested_post_info,
cost = paid_star_count,
)
is PreviewGroupChat,
null -> CommonSuggestedChannelDirectMessagesContentMessageImpl(
chat = actualForumChat,
messageId = messageId,
from = checkedFrom ?: from ?: error("It is expected that in direct channel messages from non anonymous channels user must be specified"),
date = date.asDate,
directMessageTopic = direct_messages_topic,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
suggestedPostInfo = suggested_post_info,
cost = paid_star_count,
senderTag = sender_tag,
)
}
}
}
}
is PreviewPublicChat -> when (chat) {
is PreviewChannelChat -> if (is_paid_post) {
ChannelPaidPostImpl(
messageId = messageId,
chat = chat,
senderChat = checkedFrom ?: sender_chat ?: chat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
} else {
ChannelContentMessageImpl(
messageId = messageId,
chat = chat,
senderChat = checkedFrom ?: sender_chat ?: chat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
}
is PreviewForumChat -> when(chat) {
is ForumChatImpl -> {
if (messageThreadId != null) {
val chatId = ChatIdWithThreadId(
chat.id.chatId,
messageThreadId
)
val actualForumChat = when (chat) {
is ForumChatImpl -> chat.copy(id = chatId)
}
when (sender_chat) {
is PreviewChannelChat -> FromChannelForumContentMessageImpl(
chat = actualForumChat,
channel = sender_chat,
messageId = messageId,
threadId = messageThreadId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
is PreviewGroupChat -> AnonymousForumContentMessageImpl(
chat = actualForumChat,
messageId = messageId,
threadId = messageThreadId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
null -> CommonForumContentMessageImpl(
chat = actualForumChat,
messageId = messageId,
threadId = messageThreadId,
from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
guestBotCallerUser = guest_bot_caller_user,
guestBotCallerChat = guest_bot_caller_chat,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
cost = paid_star_count,
senderTag = sender_tag,
)
}
} else {
when (sender_chat) {
is PreviewChannelChat -> if (is_automatic_forward == true) {
ConnectedFromChannelGroupContentMessageImpl(
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
} else {
UnconnectedFromChannelGroupContentMessageImpl(
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
}
is GroupChat -> AnonymousGroupContentMessageImpl(
chat = chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
null -> CommonGroupContentMessageImpl(
chat = chat,
messageId = messageId,
from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
guestBotCallerUser = guest_bot_caller_user,
guestBotCallerChat = guest_bot_caller_chat,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
cost = paid_star_count,
senderTag = sender_tag
)
}
}
}
}
is PreviewGroupChat -> when (sender_chat) {
is PreviewChannelChat -> if (is_automatic_forward == true) {
ConnectedFromChannelGroupContentMessageImpl(
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
} else {
UnconnectedFromChannelGroupContentMessageImpl(
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
}
is PreviewGroupChat -> AnonymousGroupContentMessageImpl(
chat = chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
cost = paid_star_count,
)
null -> CommonGroupContentMessageImpl(
chat = chat,
messageId = messageId,
from = checkedFrom ?: from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
guestBotCallerUser = guest_bot_caller_user,
guestBotCallerChat = guest_bot_caller_chat,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline,
cost = paid_star_count,
senderTag = sender_tag,
)
}
}
is PreviewPrivateChat -> if (business_connection_id == null) {
when {
is_topic_message == true -> {
val chatId = ChatIdWithThreadId(
chat.id.chatId,
messageThreadId ?: error("Was detected forum private message, but message thread id was not found")
)
val actualForumChat = when (chat) {
is PrivateForumChatImpl -> chat.copy(id = chatId)
is CommonUser -> chat.copy(id = chatId)
is CommonBot -> chat
is PrivateChatImpl -> PrivateForumChatImpl(
id = chatId,
username = chat.username,
firstName = chat.firstName,
lastName = chat.lastName
)
}
PrivateForumContentMessageImpl(
messageId = messageId,
from = checkedFrom ?: from ?: error("Was detected common message, but owner (sender) of the message was not found"),
threadId = messageThreadId,
threadCreatingInfo = forum_topic_created,
chat = actualForumChat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
guestBotCallerUser = guest_bot_caller_user,
guestBotCallerChat = guest_bot_caller_chat,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
effectId = effect_id,
cost = paid_star_count,
)
}
else -> {
PrivateContentMessageImpl(
messageId = messageId,
from = checkedFrom ?: from
?: error("Was detected common message, but owner (sender) of the message was not found"),
chat = chat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
guestBotCallerUser = guest_bot_caller_user,
guestBotCallerChat = guest_bot_caller_chat,
mediaGroupId = media_group_id,
fromOffline = is_from_offline,
effectId = effect_id,
cost = paid_star_count,
)
}
}
} else {
BusinessContentMessageImpl(
messageId = messageId,
from = checkedFrom ?: from ?: error("Was detected common message, but owner (sender) of the message was not found"),
chat = BusinessChatImpl(
chat.id.toBusinessChatId(business_connection_id),
chat
),
businessConnectionId = business_connection_id,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBusinessBot = sender_business_bot,
fromOffline = is_from_offline,
cost = paid_star_count,
)
}
else -> error("Unknown type of chat: $chat")
}
}
}
} ?: passport_data ?.let{
PassportMessage(

View File

@@ -6,11 +6,11 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.CommonBot
import dev.inmo.tgbotapi.types.chat.PreviewChat
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.message.abstracts.GuestContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.RequestGuestContentMessage
import dev.inmo.tgbotapi.types.message.content.MessageContent
import kotlinx.serialization.SerialName
data class GuestContentMessageImpl<T: MessageContent>(
data class RequestGuestContentMessageImpl<T: MessageContent>(
override val messageId: MessageId,
override val from: User,
override val chat: PreviewChat,
@@ -24,9 +24,7 @@ data class GuestContentMessageImpl<T: MessageContent>(
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupId?,
override val guestBotCallerUser: User,
override val guestBotCallerChat: PreviewChat,
override val fromOffline: Boolean,
@SerialName(paidMessageStarCountField)
override val cost: Int? = null,
) : GuestContentMessage<T>
) : RequestGuestContentMessage<T>

View File

@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.chat.PreviewBot
import dev.inmo.tgbotapi.types.chat.PreviewBusinessChat
import dev.inmo.tgbotapi.types.message.content.MessageContent
interface BusinessContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage,
interface BusinessContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserChatMessage,
WithBusinessConnectionId {
override val chat: PreviewBusinessChat
override val businessConnectionId: BusinessConnectionId

View File

@@ -6,3 +6,5 @@ import dev.inmo.tgbotapi.abstracts.OptionallyFromUser
interface OptionallyFromUserMessage : OptionallyFromUser, Message
interface FromUserMessage : OptionallyFromUserMessage, FromUser
interface FromUserChatMessage : FromUserMessage, ChatMessage

View File

@@ -4,6 +4,6 @@ import dev.inmo.tgbotapi.types.chat.PreviewChat
import dev.inmo.tgbotapi.types.chat.PreviewGroupChat
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent
interface GroupEventMessage<T : GroupEvent> : ChatEventMessage<T>, FromUserMessage {
interface GroupEventMessage<T : GroupEvent> : ChatEventMessage<T>, FromUserChatMessage {
override val chat: PreviewGroupChat
}

View File

@@ -49,7 +49,7 @@ interface AnonymousGroupContentMessage<T : MessageContent> : GroupContentMessage
get() = chat
}
interface CommonGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage
interface CommonGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserChatMessage, PossiblyGuestAnswerMessage
interface FromChannelForumContentMessage<T: MessageContent> : FromChannelGroupContentMessage<T>, ForumContentMessage<T>
@@ -62,8 +62,8 @@ interface AnonymousForumContentMessage<T : MessageContent> : ForumContentMessage
get() = chat
}
interface CommonForumContentMessage<T : MessageContent> : ForumContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage
interface CommonForumContentMessage<T : MessageContent> : ForumContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserChatMessage, PossiblyGuestAnswerMessage
interface CommonChannelDirectMessagesContentMessage<T : MessageContent> : ChannelDirectMessagesContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage
interface CommonChannelDirectMessagesContentMessage<T : MessageContent> : ChannelDirectMessagesContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserChatMessage
interface CommonSuggestedChannelDirectMessagesContentMessage<T : MessageContent> : SuggestedChannelDirectMessagesContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage
interface CommonSuggestedChannelDirectMessagesContentMessage<T : MessageContent> : SuggestedChannelDirectMessagesContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserChatMessage

View File

@@ -1,12 +1,11 @@
package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.GuestQueryId
import dev.inmo.tgbotapi.types.chat.CommonBot
import dev.inmo.tgbotapi.types.message.content.MessageContent
interface GuestContentMessage<T: MessageContent> : SpecialMessage,
CommonContentMessage<T>,
GuestMessage,
interface RequestGuestContentMessage<T : MessageContent> : CommonContentMessage<T>,
RequestGuestMessage,
SpecialMessage,
FromUserMessage,
PossiblySentViaBot {
override val guestQueryId: GuestQueryId
}
PossiblySentViaBot

View File

@@ -1,12 +0,0 @@
package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.abstracts.types.WithOptionalGuestQueryId
import dev.inmo.tgbotapi.types.GuestQueryId
import dev.inmo.tgbotapi.types.chat.PreviewChat
import dev.inmo.tgbotapi.types.chat.User
interface GuestMessage : WithOptionalGuestQueryId {
override val guestQueryId: GuestQueryId
val guestBotCallerUser: User
val guestBotCallerChat: PreviewChat
}

View File

@@ -0,0 +1,10 @@
package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.chat.PreviewChat
import dev.inmo.tgbotapi.types.chat.PreviewUser
import dev.inmo.tgbotapi.types.chat.User
interface PossiblyGuestAnswerMessage : Message {
val guestBotCallerUser: PreviewUser?
val guestBotCallerChat: PreviewChat?
}

View File

@@ -3,6 +3,10 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.chat.PreviewPrivateChat
import dev.inmo.tgbotapi.types.message.content.MessageContent
interface PrivateContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage, PossiblyOfflineMessage, PossiblyWithEffectMessage {
interface PrivateContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>,
FromUserChatMessage,
PossiblyOfflineMessage,
PossiblyWithEffectMessage,
PossiblyGuestAnswerMessage {
override val chat: PreviewPrivateChat
}

View File

@@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.abstracts.types.WithOptionalGuestQueryId
import dev.inmo.tgbotapi.types.GuestQueryId
interface RequestGuestMessage : Message, WithOptionalGuestQueryId {
override val guestQueryId: GuestQueryId
}

View File

@@ -55,6 +55,7 @@ sealed interface MessageContent: ResendableContent {
subclass(StoryContent::class)
subclass(GiveawayPublicResultsContent::class)
subclass(GiveawayContent::class)
subclass(RichMessageContent::class)
additionalBuilder()
}

View File

@@ -0,0 +1,44 @@
package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.ForwardMessage
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.message.abstracts.ChatContentMessage
import dev.inmo.tgbotapi.types.rich.RichMessage
import kotlinx.serialization.Serializable
@Serializable
data class RichMessageContent(
private val chat: Chat,
private val messageId: MessageId,
val richMessage: RichMessage
) : MessageContent {
override fun createResend(
chatId: ChatIdentifier,
messageThreadId: MessageThreadId?,
directMessageThreadId: DirectMessageThreadId?,
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
allowPaidBroadcast: Boolean,
effectId: EffectId?,
suggestedPostParameters: SuggestedPostParameters?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ChatContentMessage<RichMessageContent>> {
@Suppress("UNCHECKED_CAST")
return ForwardMessage(
chat.id,
toChatId = chatId,
messageId = messageId,
threadId = messageThreadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent
) as Request<ChatContentMessage<RichMessageContent>>
}
}

View File

@@ -13,6 +13,8 @@ typealias PollMessage = ChatContentMessage<PollContent>
typealias TextMessage = ChatContentMessage<TextContent>
typealias StoryMessage = ChatContentMessage<StoryContent>
typealias RichMessageContentMessage = ChatContentMessage<RichMessageContent>
typealias LocationMessage = ChatContentMessage<LocationContent>
typealias LiveLocationMessage = ChatContentMessage<LiveLocationContent>
typealias StaticLocationMessage = ChatContentMessage<StaticLocationContent>

View File

@@ -0,0 +1,65 @@
package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.htmlField
import dev.inmo.tgbotapi.types.isRtlField
import dev.inmo.tgbotapi.types.markdownField
import dev.inmo.tgbotapi.types.skipEntityDetectionField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Describes a rich message to be sent. Exactly one of the fields [html] or [markdown] must be used. Use the
* [InputRichMessageHTML] and [InputRichMessageMarkdown] factories to build an instance.
*
* @see <a href="https://core.telegram.org/bots/api#inputrichmessage">InputRichMessage</a>
*/
@ConsistentCopyVisibility
@Serializable
data class InputRichMessage internal constructor(
@SerialName(htmlField)
val html: String? = null,
@SerialName(markdownField)
val markdown: String? = null,
@SerialName(isRtlField)
val isRtl: Boolean? = null,
@SerialName(skipEntityDetectionField)
val skipEntityDetection: Boolean? = null
) {
init {
require((html == null) != (markdown == null)) {
"Exactly one of the fields html or markdown must be used in InputRichMessage"
}
}
}
/**
* Creates an [InputRichMessage] with the content described using HTML formatting.
*
* @see <a href="https://core.telegram.org/bots/api#inputrichmessage">InputRichMessage</a>
*/
fun InputRichMessageHTML(
html: String,
isRtl: Boolean? = null,
skipEntityDetection: Boolean? = null
): InputRichMessage = InputRichMessage(
html = html,
markdown = null,
isRtl = isRtl,
skipEntityDetection = skipEntityDetection
)
/**
* Creates an [InputRichMessage] with the content described using Markdown formatting.
*
* @see <a href="https://core.telegram.org/bots/api#inputrichmessage">InputRichMessage</a>
*/
fun InputRichMessageMarkdown(
markdown: String,
isRtl: Boolean? = null,
skipEntityDetection: Boolean? = null
): InputRichMessage = InputRichMessage(
html = null,
markdown = markdown,
isRtl = isRtl,
skipEntityDetection = skipEntityDetection
)

View File

@@ -0,0 +1,50 @@
package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.typeField
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonContentPolymorphicSerializer
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
/**
* Represents a block in a rich formatted message.
*
* @see <a href="https://core.telegram.org/bots/api#richblock">RichBlock</a>
*/
@Serializable(RichBlockSerializer::class)
@ClassCastsIncluded
sealed interface RichBlock {
val type: String
}
object RichBlockSerializer : JsonContentPolymorphicSerializer<RichBlock>(RichBlock::class) {
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<RichBlock> {
return when (val type = element.jsonObject[typeField]?.jsonPrimitive?.content) {
RichBlockParagraph.TYPE -> RichBlockParagraph.serializer()
RichBlockSectionHeading.TYPE -> RichBlockSectionHeading.serializer()
RichBlockPreformatted.TYPE -> RichBlockPreformatted.serializer()
RichBlockFooter.TYPE -> RichBlockFooter.serializer()
RichBlockDivider.TYPE -> RichBlockDivider.serializer()
RichBlockMathematicalExpression.TYPE -> RichBlockMathematicalExpression.serializer()
RichBlockAnchor.TYPE -> RichBlockAnchor.serializer()
RichBlockList.TYPE -> RichBlockList.serializer()
RichBlockBlockQuotation.TYPE -> RichBlockBlockQuotation.serializer()
RichBlockPullQuotation.TYPE -> RichBlockPullQuotation.serializer()
RichBlockCollage.TYPE -> RichBlockCollage.serializer()
RichBlockSlideshow.TYPE -> RichBlockSlideshow.serializer()
RichBlockTable.TYPE -> RichBlockTable.serializer()
RichBlockDetails.TYPE -> RichBlockDetails.serializer()
RichBlockMap.TYPE -> RichBlockMap.serializer()
RichBlockAnimation.TYPE -> RichBlockAnimation.serializer()
RichBlockAudio.TYPE -> RichBlockAudio.serializer()
RichBlockPhoto.TYPE -> RichBlockPhoto.serializer()
RichBlockVideo.TYPE -> RichBlockVideo.serializer()
RichBlockVoiceNote.TYPE -> RichBlockVoiceNote.serializer()
RichBlockThinking.TYPE -> RichBlockThinking.serializer()
else -> error("Unknown RichBlock type: $type")
}
}
}

View File

@@ -0,0 +1,75 @@
package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.alignField
import dev.inmo.tgbotapi.types.blocksField
import dev.inmo.tgbotapi.types.colspanField
import dev.inmo.tgbotapi.types.creditField
import dev.inmo.tgbotapi.types.hasCheckboxField
import dev.inmo.tgbotapi.types.isCheckedField
import dev.inmo.tgbotapi.types.isHeaderField
import dev.inmo.tgbotapi.types.labelField
import dev.inmo.tgbotapi.types.rowspanField
import dev.inmo.tgbotapi.types.textField
import dev.inmo.tgbotapi.types.typeField
import dev.inmo.tgbotapi.types.valignField
import dev.inmo.tgbotapi.types.valueField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Caption of a rich formatted block.
*
* @see <a href="https://core.telegram.org/bots/api#richblockcaption">RichBlockCaption</a>
*/
@Serializable
data class RichBlockCaption(
@SerialName(textField)
val text: RichText,
@SerialName(creditField)
val credit: RichText? = null
)
/**
* A cell in a [RichBlockTable].
*
* @see <a href="https://core.telegram.org/bots/api#richblocktablecell">RichBlockTableCell</a>
*/
@Serializable
data class RichBlockTableCell(
@SerialName(textField)
val text: RichText? = null,
@SerialName(isHeaderField)
val isHeader: Boolean? = null,
@SerialName(colspanField)
val colspan: Int? = null,
@SerialName(rowspanField)
val rowspan: Int? = null,
@SerialName(alignField)
val align: String,
@SerialName(valignField)
val valign: String
)
/**
* An item of a [RichBlockList].
*
* @see <a href="https://core.telegram.org/bots/api#richblocklistitem">RichBlockListItem</a>
*/
@Serializable
data class RichBlockListItem(
@SerialName(labelField)
val label: String,
@SerialName(blocksField)
val blocks: List<RichBlock>,
@SerialName(hasCheckboxField)
val hasCheckbox: Boolean? = null,
@SerialName(isCheckedField)
val isChecked: Boolean? = null,
@SerialName(valueField)
val value: Int? = null,
/**
* For ordered lists, the type of the item label; must be one of "a", "A", "i", "I" or "1".
*/
@SerialName(typeField)
val labelType: String? = null
)

View File

@@ -0,0 +1,490 @@
package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.animationField
import dev.inmo.tgbotapi.types.audioField
import dev.inmo.tgbotapi.types.blocksField
import dev.inmo.tgbotapi.types.captionField
import dev.inmo.tgbotapi.types.cellsField
import dev.inmo.tgbotapi.types.creditField
import dev.inmo.tgbotapi.types.expressionField
import dev.inmo.tgbotapi.types.files.AnimationFile
import dev.inmo.tgbotapi.types.files.AudioFile
import dev.inmo.tgbotapi.types.files.PhotoFile
import dev.inmo.tgbotapi.types.files.VideoFile
import dev.inmo.tgbotapi.types.files.VoiceFile
import dev.inmo.tgbotapi.types.hasSpoilerField
import dev.inmo.tgbotapi.types.heightField
import dev.inmo.tgbotapi.types.isBorderedField
import dev.inmo.tgbotapi.types.isOpenField
import dev.inmo.tgbotapi.types.isStripedField
import dev.inmo.tgbotapi.types.itemsField
import dev.inmo.tgbotapi.types.languageField
import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.locationField
import dev.inmo.tgbotapi.types.nameField
import dev.inmo.tgbotapi.types.photoField
import dev.inmo.tgbotapi.types.sizeField
import dev.inmo.tgbotapi.types.summaryField
import dev.inmo.tgbotapi.types.textField
import dev.inmo.tgbotapi.types.typeField
import dev.inmo.tgbotapi.types.videoField
import dev.inmo.tgbotapi.types.voiceNoteField
import dev.inmo.tgbotapi.types.widthField
import dev.inmo.tgbotapi.types.zoomField
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* A text paragraph.
*
* @see <a href="https://core.telegram.org/bots/api#richblockparagraph">RichBlockParagraph</a>
*/
@Serializable
data class RichBlockParagraph(
@SerialName(textField)
val text: RichText
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "paragraph"
}
}
/**
* A section heading.
*
* @see <a href="https://core.telegram.org/bots/api#richblocksectionheading">RichBlockSectionHeading</a>
*/
@Serializable
data class RichBlockSectionHeading(
@SerialName(textField)
val text: RichText,
/**
* Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest.
*/
@SerialName(sizeField)
val size: Int
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "heading"
}
}
/**
* A preformatted text block.
*
* @see <a href="https://core.telegram.org/bots/api#richblockpreformatted">RichBlockPreformatted</a>
*/
@Serializable
data class RichBlockPreformatted(
@SerialName(textField)
val text: RichText,
@SerialName(languageField)
val language: String? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "pre"
}
}
/**
* A footer.
*
* @see <a href="https://core.telegram.org/bots/api#richblockfooter">RichBlockFooter</a>
*/
@Serializable
data class RichBlockFooter(
@SerialName(textField)
val text: RichText
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "footer"
}
}
/**
* A divider.
*
* @see <a href="https://core.telegram.org/bots/api#richblockdivider">RichBlockDivider</a>
*/
@Serializable
class RichBlockDivider : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
override fun equals(other: Any?): Boolean = other is RichBlockDivider
override fun hashCode(): Int = TYPE.hashCode()
override fun toString(): String = "RichBlockDivider"
companion object {
const val TYPE = "divider"
}
}
/**
* A block with a mathematical expression in LaTeX format.
*
* @see <a href="https://core.telegram.org/bots/api#richblockmathematicalexpression">RichBlockMathematicalExpression</a>
*/
@Serializable
data class RichBlockMathematicalExpression(
@SerialName(expressionField)
val expression: String
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "mathematical_expression"
}
}
/**
* A block with an anchor.
*
* @see <a href="https://core.telegram.org/bots/api#richblockanchor">RichBlockAnchor</a>
*/
@Serializable
data class RichBlockAnchor(
@SerialName(nameField)
val name: String
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "anchor"
}
}
/**
* A list of blocks.
*
* @see <a href="https://core.telegram.org/bots/api#richblocklist">RichBlockList</a>
*/
@Serializable
data class RichBlockList(
@SerialName(itemsField)
val items: List<RichBlockListItem>
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "list"
}
}
/**
* A block quotation.
*
* @see <a href="https://core.telegram.org/bots/api#richblockblockquotation">RichBlockBlockQuotation</a>
*/
@Serializable
data class RichBlockBlockQuotation(
@SerialName(blocksField)
val blocks: List<RichBlock>,
@SerialName(creditField)
val credit: RichText? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "blockquote"
}
}
/**
* A quotation with centered text.
*
* @see <a href="https://core.telegram.org/bots/api#richblockpullquotation">RichBlockPullQuotation</a>
*/
@Serializable
data class RichBlockPullQuotation(
@SerialName(textField)
val text: RichText,
@SerialName(creditField)
val credit: RichText? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "pullquote"
}
}
/**
* A collage.
*
* @see <a href="https://core.telegram.org/bots/api#richblockcollage">RichBlockCollage</a>
*/
@Serializable
data class RichBlockCollage(
@SerialName(blocksField)
val blocks: List<RichBlock>,
@SerialName(captionField)
val caption: RichBlockCaption? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "collage"
}
}
/**
* A slideshow.
*
* @see <a href="https://core.telegram.org/bots/api#richblockslideshow">RichBlockSlideshow</a>
*/
@Serializable
data class RichBlockSlideshow(
@SerialName(blocksField)
val blocks: List<RichBlock>,
@SerialName(captionField)
val caption: RichBlockCaption? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "slideshow"
}
}
/**
* A table.
*
* @see <a href="https://core.telegram.org/bots/api#richblocktable">RichBlockTable</a>
*/
@Serializable
data class RichBlockTable(
@SerialName(cellsField)
val cells: List<List<RichBlockTableCell>>,
@SerialName(isBorderedField)
val isBordered: Boolean? = null,
@SerialName(isStripedField)
val isStriped: Boolean? = null,
@SerialName(captionField)
val caption: RichText? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "table"
}
}
/**
* An expandable block for details disclosure.
*
* @see <a href="https://core.telegram.org/bots/api#richblockdetails">RichBlockDetails</a>
*/
@Serializable
data class RichBlockDetails(
@SerialName(summaryField)
val summary: RichText,
@SerialName(blocksField)
val blocks: List<RichBlock>,
@SerialName(isOpenField)
val isOpen: Boolean? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "details"
}
}
/**
* A block with a map.
*
* @see <a href="https://core.telegram.org/bots/api#richblockmap">RichBlockMap</a>
*/
@Serializable
data class RichBlockMap(
@SerialName(locationField)
val location: StaticLocation,
/**
* Map zoom level; 13-20.
*/
@SerialName(zoomField)
val zoom: Int,
@SerialName(widthField)
val width: Int,
@SerialName(heightField)
val height: Int,
@SerialName(captionField)
val caption: RichBlockCaption? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "map"
}
}
/**
* A block with an animation.
*
* @see <a href="https://core.telegram.org/bots/api#richblockanimation">RichBlockAnimation</a>
*/
@Serializable
data class RichBlockAnimation(
@SerialName(animationField)
val animation: AnimationFile,
@SerialName(hasSpoilerField)
val hasSpoiler: Boolean? = null,
@SerialName(captionField)
val caption: RichBlockCaption? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "animation"
}
}
/**
* A block with a music file.
*
* @see <a href="https://core.telegram.org/bots/api#richblockaudio">RichBlockAudio</a>
*/
@Serializable
data class RichBlockAudio(
@SerialName(audioField)
val audio: AudioFile,
@SerialName(captionField)
val caption: RichBlockCaption? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "audio"
}
}
/**
* A block with a photo.
*
* @see <a href="https://core.telegram.org/bots/api#richblockphoto">RichBlockPhoto</a>
*/
@Serializable
data class RichBlockPhoto(
@SerialName(photoField)
val photo: PhotoFile,
@SerialName(hasSpoilerField)
val hasSpoiler: Boolean? = null,
@SerialName(captionField)
val caption: RichBlockCaption? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "photo"
}
}
/**
* A block with a video.
*
* @see <a href="https://core.telegram.org/bots/api#richblockvideo">RichBlockVideo</a>
*/
@Serializable
data class RichBlockVideo(
@SerialName(videoField)
val video: VideoFile,
@SerialName(hasSpoilerField)
val hasSpoiler: Boolean? = null,
@SerialName(captionField)
val caption: RichBlockCaption? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "video"
}
}
/**
* A block with a voice note.
*
* @see <a href="https://core.telegram.org/bots/api#richblockvoicenote">RichBlockVoiceNote</a>
*/
@Serializable
data class RichBlockVoiceNote(
@SerialName(voiceNoteField)
val voiceNote: VoiceFile,
@SerialName(captionField)
val caption: RichBlockCaption? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "voice_note"
}
}
/**
* A block with a "Thinking…" placeholder. May be used only in sendRichMessageDraft.
*
* @see <a href="https://core.telegram.org/bots/api#richblockthinking">RichBlockThinking</a>
*/
@Serializable
data class RichBlockThinking(
@SerialName(textField)
val text: RichText
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "thinking"
}
}

View File

@@ -0,0 +1,19 @@
package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.blocksField
import dev.inmo.tgbotapi.types.isRtlField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Rich formatted message.
*
* @see <a href="https://core.telegram.org/bots/api#richmessage">RichMessage</a>
*/
@Serializable
data class RichMessage(
@SerialName(blocksField)
val blocks: List<RichBlock>,
@SerialName(isRtlField)
val isRtl: Boolean? = null
)

View File

@@ -0,0 +1,104 @@
package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.typeField
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.*
/**
* Represents a rich formatted text. It can be either a plain text ([RichTextPlain]), a group of rich texts
* ([RichTextGroup]) or any of [RichTextEntity] subtypes.
*
* @see <a href="https://core.telegram.org/bots/api#richtext">RichText</a>
*/
@Serializable(RichTextSerializer::class)
@ClassCastsIncluded
sealed interface RichText
/**
* A plain (non-formatted) part of a [RichText]. Serialized as a bare JSON string.
*/
@Serializable
data class RichTextPlain(
val text: String
) : RichText
/**
* A group of [RichText]s. Serialized as a JSON array.
*/
@Serializable
data class RichTextGroup(
val parts: List<RichText>
) : RichText
/**
* Any typed (formatted) part of a [RichText]. Serialized as a JSON object with the [type] discriminator.
*/
@Serializable(RichTextEntitySerializer::class)
sealed interface RichTextEntity : RichText {
val type: String
}
object RichTextSerializer : KSerializer<RichText> {
override val descriptor: SerialDescriptor = JsonElement.serializer().descriptor
private fun fromJson(json: Json, element: JsonElement): RichText = when (element) {
is JsonArray -> RichTextGroup(element.map { fromJson(json, it) })
is JsonObject -> json.decodeFromJsonElement(RichTextEntitySerializer, element)
is JsonPrimitive -> RichTextPlain(element.content)
}
private fun toJson(json: Json, value: RichText): JsonElement = when (value) {
is RichTextPlain -> JsonPrimitive(value.text)
is RichTextGroup -> JsonArray(value.parts.map { toJson(json, it) })
is RichTextEntity -> json.encodeToJsonElement(RichTextEntitySerializer, value)
}
override fun deserialize(decoder: Decoder): RichText {
val input = decoder as JsonDecoder
return fromJson(input.json, input.decodeJsonElement())
}
override fun serialize(encoder: Encoder, value: RichText) {
val output = encoder as JsonEncoder
output.encodeJsonElement(toJson(output.json, value))
}
}
object RichTextEntitySerializer : JsonContentPolymorphicSerializer<RichTextEntity>(RichTextEntity::class) {
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<RichTextEntity> {
return when (val type = element.jsonObject[typeField]?.jsonPrimitive?.content) {
RichTextBold.TYPE -> RichTextBold.serializer()
RichTextItalic.TYPE -> RichTextItalic.serializer()
RichTextUnderline.TYPE -> RichTextUnderline.serializer()
RichTextStrikethrough.TYPE -> RichTextStrikethrough.serializer()
RichTextSpoiler.TYPE -> RichTextSpoiler.serializer()
RichTextDateTime.TYPE -> RichTextDateTime.serializer()
RichTextTextMention.TYPE -> RichTextTextMention.serializer()
RichTextSubscript.TYPE -> RichTextSubscript.serializer()
RichTextSuperscript.TYPE -> RichTextSuperscript.serializer()
RichTextMarked.TYPE -> RichTextMarked.serializer()
RichTextCode.TYPE -> RichTextCode.serializer()
RichTextCustomEmoji.TYPE -> RichTextCustomEmoji.serializer()
RichTextMathematicalExpression.TYPE -> RichTextMathematicalExpression.serializer()
RichTextUrl.TYPE -> RichTextUrl.serializer()
RichTextEmailAddress.TYPE -> RichTextEmailAddress.serializer()
RichTextPhoneNumber.TYPE -> RichTextPhoneNumber.serializer()
RichTextBankCardNumber.TYPE -> RichTextBankCardNumber.serializer()
RichTextMention.TYPE -> RichTextMention.serializer()
RichTextHashtag.TYPE -> RichTextHashtag.serializer()
RichTextCashtag.TYPE -> RichTextCashtag.serializer()
RichTextBotCommand.TYPE -> RichTextBotCommand.serializer()
RichTextAnchor.TYPE -> RichTextAnchor.serializer()
RichTextAnchorLink.TYPE -> RichTextAnchorLink.serializer()
RichTextReference.TYPE -> RichTextReference.serializer()
RichTextReferenceLink.TYPE -> RichTextReferenceLink.serializer()
else -> error("Unknown RichTextEntity type: $type")
}
}
}

View File

@@ -0,0 +1,531 @@
package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.CustomEmojiId
import dev.inmo.tgbotapi.types.alternativeTextField
import dev.inmo.tgbotapi.types.anchorNameField
import dev.inmo.tgbotapi.types.bankCardNumberField
import dev.inmo.tgbotapi.types.botCommandField
import dev.inmo.tgbotapi.types.cashtagField
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.customEmojiIdField
import dev.inmo.tgbotapi.types.dateTimeFormatField
import dev.inmo.tgbotapi.types.emailAddressField
import dev.inmo.tgbotapi.types.expressionField
import dev.inmo.tgbotapi.types.hashtagField
import dev.inmo.tgbotapi.types.nameField
import dev.inmo.tgbotapi.types.phoneNumberField
import dev.inmo.tgbotapi.types.referenceNameField
import dev.inmo.tgbotapi.types.textField
import dev.inmo.tgbotapi.types.typeField
import dev.inmo.tgbotapi.types.unixTimeField
import dev.inmo.tgbotapi.types.urlField
import dev.inmo.tgbotapi.types.userField
import dev.inmo.tgbotapi.types.usernameField
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* A bold [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextbold">RichTextBold</a>
*/
@Serializable
data class RichTextBold(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "bold"
}
}
/**
* An italicized [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextitalic">RichTextItalic</a>
*/
@Serializable
data class RichTextItalic(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "italic"
}
}
/**
* An underlined [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextunderline">RichTextUnderline</a>
*/
@Serializable
data class RichTextUnderline(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "underline"
}
}
/**
* A strikethrough [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextstrikethrough">RichTextStrikethrough</a>
*/
@Serializable
data class RichTextStrikethrough(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "strikethrough"
}
}
/**
* A [RichTextEntity] covered by a spoiler.
*
* @see <a href="https://core.telegram.org/bots/api#richtextspoiler">RichTextSpoiler</a>
*/
@Serializable
data class RichTextSpoiler(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "spoiler"
}
}
/**
* A subscript [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextsubscript">RichTextSubscript</a>
*/
@Serializable
data class RichTextSubscript(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "subscript"
}
}
/**
* A superscript [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextsuperscript">RichTextSuperscript</a>
*/
@Serializable
data class RichTextSuperscript(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "superscript"
}
}
/**
* A marked [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextmarked">RichTextMarked</a>
*/
@Serializable
data class RichTextMarked(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "marked"
}
}
/**
* A monowidth [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextcode">RichTextCode</a>
*/
@Serializable
data class RichTextCode(
@SerialName(textField)
val text: RichText
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "code"
}
}
/**
* A formatted date and time [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextdatetime">RichTextDateTime</a>
*/
@Serializable
data class RichTextDateTime(
@SerialName(textField)
val text: RichText,
@SerialName(unixTimeField)
val unixTime: Long,
@SerialName(dateTimeFormatField)
val dateTimeFormat: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "date_time"
}
}
/**
* A mention of a Telegram user by their identifier.
*
* @see <a href="https://core.telegram.org/bots/api#richtexttextmention">RichTextTextMention</a>
*/
@Serializable
data class RichTextTextMention(
@SerialName(textField)
val text: RichText,
@SerialName(userField)
val user: User
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "text_mention"
}
}
/**
* A custom emoji [RichTextEntity].
*
* @see <a href="https://core.telegram.org/bots/api#richtextcustomemoji">RichTextCustomEmoji</a>
*/
@Serializable
data class RichTextCustomEmoji(
@SerialName(customEmojiIdField)
val customEmojiId: CustomEmojiId,
@SerialName(alternativeTextField)
val alternativeText: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "custom_emoji"
}
}
/**
* A mathematical expression in LaTeX format.
*
* @see <a href="https://core.telegram.org/bots/api#richtextmathematicalexpression">RichTextMathematicalExpression</a>
*/
@Serializable
data class RichTextMathematicalExpression(
@SerialName(expressionField)
val expression: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "mathematical_expression"
}
}
/**
* A [RichTextEntity] with a link.
*
* @see <a href="https://core.telegram.org/bots/api#richtexturl">RichTextUrl</a>
*/
@Serializable
data class RichTextUrl(
@SerialName(textField)
val text: RichText,
@SerialName(urlField)
val url: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "url"
}
}
/**
* A [RichTextEntity] with an email address.
*
* @see <a href="https://core.telegram.org/bots/api#richtextemailaddress">RichTextEmailAddress</a>
*/
@Serializable
data class RichTextEmailAddress(
@SerialName(textField)
val text: RichText,
@SerialName(emailAddressField)
val emailAddress: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "email_address"
}
}
/**
* A [RichTextEntity] with a phone number.
*
* @see <a href="https://core.telegram.org/bots/api#richtextphonenumber">RichTextPhoneNumber</a>
*/
@Serializable
data class RichTextPhoneNumber(
@SerialName(textField)
val text: RichText,
@SerialName(phoneNumberField)
val phoneNumber: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "phone_number"
}
}
/**
* A [RichTextEntity] with a bank card number.
*
* @see <a href="https://core.telegram.org/bots/api#richtextbankcardnumber">RichTextBankCardNumber</a>
*/
@Serializable
data class RichTextBankCardNumber(
@SerialName(textField)
val text: RichText,
@SerialName(bankCardNumberField)
val bankCardNumber: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "bank_card_number"
}
}
/**
* A mention by a username.
*
* @see <a href="https://core.telegram.org/bots/api#richtextmention">RichTextMention</a>
*/
@Serializable
data class RichTextMention(
@SerialName(textField)
val text: RichText,
@SerialName(usernameField)
val username: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "mention"
}
}
/**
* A hashtag.
*
* @see <a href="https://core.telegram.org/bots/api#richtexthashtag">RichTextHashtag</a>
*/
@Serializable
data class RichTextHashtag(
@SerialName(textField)
val text: RichText,
@SerialName(hashtagField)
val hashtag: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "hashtag"
}
}
/**
* A cashtag.
*
* @see <a href="https://core.telegram.org/bots/api#richtextcashtag">RichTextCashtag</a>
*/
@Serializable
data class RichTextCashtag(
@SerialName(textField)
val text: RichText,
@SerialName(cashtagField)
val cashtag: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "cashtag"
}
}
/**
* A bot command.
*
* @see <a href="https://core.telegram.org/bots/api#richtextbotcommand">RichTextBotCommand</a>
*/
@Serializable
data class RichTextBotCommand(
@SerialName(textField)
val text: RichText,
@SerialName(botCommandField)
val botCommand: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "bot_command"
}
}
/**
* An anchor.
*
* @see <a href="https://core.telegram.org/bots/api#richtextanchor">RichTextAnchor</a>
*/
@Serializable
data class RichTextAnchor(
@SerialName(nameField)
val name: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "anchor"
}
}
/**
* A link to an anchor.
*
* @see <a href="https://core.telegram.org/bots/api#richtextanchorlink">RichTextAnchorLink</a>
*/
@Serializable
data class RichTextAnchorLink(
@SerialName(textField)
val text: RichText,
@SerialName(anchorNameField)
val anchorName: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "anchor_link"
}
}
/**
* A reference.
*
* @see <a href="https://core.telegram.org/bots/api#richtextreference">RichTextReference</a>
*/
@Serializable
data class RichTextReference(
@SerialName(textField)
val text: RichText,
@SerialName(nameField)
val name: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "reference"
}
}
/**
* A link to a reference.
*
* @see <a href="https://core.telegram.org/bots/api#richtextreferencelink">RichTextReferenceLink</a>
*/
@Serializable
data class RichTextReferenceLink(
@SerialName(textField)
val text: RichText,
@SerialName(referenceNameField)
val referenceName: String
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "reference_link"
}
}

View File

@@ -2,17 +2,15 @@ package dev.inmo.tgbotapi.types.update
import dev.inmo.tgbotapi.types.UpdateId
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.CommonContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.GuestContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.RequestGuestContentMessage
import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
data class GuestMessageUpdate(
override val updateId: UpdateId,
override val data: GuestContentMessage<*>
override val data: RequestGuestContentMessage<*>
) : BaseSentMessageUpdate {
/**
* @param newData Must be [GuestContentMessage]
*/
override fun copy(newData: AccessibleMessage) = copy(updateId, newData as GuestContentMessage<*>)
override fun copy(newData: AccessibleMessage) = copy(updateId, newData as RequestGuestContentMessage<*>)
}

View File

@@ -66,7 +66,7 @@ internal data class RawUpdate constructor(
private val deleted_business_messages: BusinessMessagesDeleted? = null,
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class)
private val guest_message: GuestContentMessage<*>? = null,
private val guest_message: RequestGuestContentMessage<*>? = null,
private val purchased_paid_media: PaidMediaPurchased? = null,
private val managed_bot: ManagedBotUpdated? = null,
) {

View File

@@ -62,6 +62,8 @@ fun <T : MediaGroupPartContent> List<CommonContentMessage<T>>.asMediaGroupMessag
replyInfo = sourceMessage.replyInfo,
replyMarkup = sourceMessage.replyMarkup,
senderBot = sourceMessage.senderBot,
guestBotCallerUser = sourceMessage.guestBotCallerUser,
guestBotCallerChat = sourceMessage.guestBotCallerChat,
mediaGroupId = sourceMessage.mediaGroupId,
fromOffline = sourceMessage.fromOffline,
effectId = sourceMessage.effectId,
@@ -95,6 +97,8 @@ fun <T : MediaGroupPartContent> List<CommonContentMessage<T>>.asMediaGroupMessag
replyMarkup = sourceMessage.replyMarkup,
content = content,
senderBot = sourceMessage.senderBot,
guestBotCallerUser = sourceMessage.guestBotCallerUser,
guestBotCallerChat = sourceMessage.guestBotCallerChat,
mediaGroupId = sourceMessage.mediaGroupId,
senderBoostsCount = sourceMessage.senderBoostsCount,
fromOffline = sourceMessage.fromOffline,
@@ -165,6 +169,8 @@ fun <T : MediaGroupPartContent> List<CommonContentMessage<T>>.asMediaGroupMessag
replyMarkup = sourceMessage.replyMarkup,
content = content,
senderBot = sourceMessage.senderBot,
guestBotCallerUser = sourceMessage.guestBotCallerUser,
guestBotCallerChat = sourceMessage.guestBotCallerChat,
mediaGroupId = sourceMessage.mediaGroupId,
senderBoostsCount = sourceMessage.senderBoostsCount,
fromOffline = sourceMessage.fromOffline,
@@ -267,7 +273,7 @@ fun <T : MediaGroupPartContent> List<CommonContentMessage<T>>.asMediaGroupMessag
suggestedPostInfo = sourceMessage.suggestedPostInfo,
cost = sourceMessage.cost,
)
is GuestContentMessage -> GuestContentMessageImpl(
is RequestGuestContentMessage -> RequestGuestContentMessageImpl(
messageId = sourceMessage.messageId,
from = sourceMessage.user,
chat = sourceMessage.chat,
@@ -281,8 +287,6 @@ fun <T : MediaGroupPartContent> List<CommonContentMessage<T>>.asMediaGroupMessag
replyMarkup = sourceMessage.replyMarkup,
senderBot = sourceMessage.senderBot,
mediaGroupId = sourceMessage.mediaGroupId,
guestBotCallerUser = sourceMessage.guestBotCallerUser,
guestBotCallerChat = sourceMessage.guestBotCallerChat,
fromOffline = sourceMessage.fromOffline,
cost = sourceMessage.cost,
)

View File

@@ -0,0 +1,39 @@
package dev.inmo.tgbotapi.bot.exceptions
import dev.inmo.tgbotapi.types.Response
import kotlin.test.Test
import kotlin.test.assertIs
/**
* Regression tests for https://github.com/InsanusMokrassar/TelegramBotAPI/issues/1008 —
* Telegram's "Too Many Requests" response is case-inconsistent (both
* `Too Many Requests` and `too Many Requests` have been observed), so the
* description match must be case-insensitive.
*/
class NewRequestExceptionTests {
private fun buildException(description: String) = newRequestException(
response = Response(ok = false, description = description, errorCode = 429),
plainAnswer = "{\"ok\":false}"
)
@Test
fun tooMuchRequestsExceptionIsCreatedForCanonicalCasing() {
assertIs<TooMuchRequestsException>(
buildException("Bad Request: Too Many Requests: retry after 8")
)
}
@Test
fun tooMuchRequestsExceptionIsCreatedForLowercaseFirstLetterCasing() {
assertIs<TooMuchRequestsException>(
buildException("Bad Request: too Many Requests: retry after 8")
)
}
@Test
fun tooMuchRequestsExceptionIsCreatedForAllLowercaseCasing() {
assertIs<TooMuchRequestsException>(
buildException("Bad Request: too many requests: retry after 8")
)
}
}

View File

@@ -0,0 +1,72 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.types.rich.*
import kotlinx.serialization.json.Json
import kotlinx.serialization.encodeToString
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class RichMessageSerializationTest {
private val json = Json { encodeDefaults = true }
@Test
fun decodesRichMessageWithMixedRichText() {
val source = """
{
"blocks": [
{
"type": "paragraph",
"text": ["Hello ", {"type": "bold", "text": "world"}, "!"]
},
{"type": "heading", "text": "Title", "size": 1},
{"type": "divider"},
{"type": "list", "items": [
{"label": "1", "blocks": [{"type": "paragraph", "text": "first"}]}
]}
],
"is_rtl": false
}
""".trimIndent()
val message = json.decodeFromString(RichMessage.serializer(), source)
assertEquals(4, message.blocks.size)
val paragraph = message.blocks[0] as RichBlockParagraph
val group = paragraph.text as RichTextGroup
assertEquals(RichTextPlain("Hello "), group.parts[0])
assertEquals(RichTextBold(RichTextPlain("world")), group.parts[1])
assertEquals(RichTextPlain("!"), group.parts[2])
val heading = message.blocks[1] as RichBlockSectionHeading
assertEquals(RichTextPlain("Title"), heading.text)
assertEquals(1, heading.size)
assertTrue(message.blocks[2] is RichBlockDivider)
val list = message.blocks[3] as RichBlockList
assertEquals("1", list.items[0].label)
}
@Test
fun roundTripsRichMessage() {
val message = RichMessage(
blocks = listOf(
RichBlockParagraph(
RichTextGroup(
listOf(
RichTextPlain("a "),
RichTextItalic(RichTextPlain("b")),
RichTextUrl(RichTextPlain("link"), "https://example.org")
)
)
),
RichBlockDivider()
)
)
val encoded = json.encodeToString(RichMessage.serializer(), message)
val decoded = json.decodeFromString(RichMessage.serializer(), encoded)
assertEquals(message, decoded)
}
}

View File

@@ -1094,6 +1094,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun anonymousGroupContentMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/AnonymousGroupContentMessage;
public static final fun anyOrNull (Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers;)Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers$Any;
public static final fun anyOrThrow (Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers;)Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers$Any;
public static final fun apiExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/ApiException;
public static final fun apiExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/ApiException;
public static final fun approximateScheduledCloseInfoOrNull (Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)Ldev/inmo/tgbotapi/types/polls/ApproximateScheduledCloseInfo;
public static final fun approximateScheduledCloseInfoOrThrow (Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)Ldev/inmo/tgbotapi/types/polls/ApproximateScheduledCloseInfo;
public static final fun audioContentOrNull (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/AudioContent;
@@ -1264,6 +1266,10 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun chosenInlineResultUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/ChosenInlineResultUpdate;
public static final fun codeTextSourceOrNull (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/CodeTextSource;
public static final fun codeTextSourceOrThrow (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/CodeTextSource;
public static final fun commonBotExceptionDefaultOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/CommonBotException$Default;
public static final fun commonBotExceptionDefaultOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/CommonBotException$Default;
public static final fun commonBotExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/CommonBotException;
public static final fun commonBotExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/CommonBotException;
public static final fun commonBotOrNull (Ldev/inmo/tgbotapi/types/chat/Chat;)Ldev/inmo/tgbotapi/types/chat/CommonBot;
public static final fun commonBotOrThrow (Ldev/inmo/tgbotapi/types/chat/Chat;)Ldev/inmo/tgbotapi/types/chat/CommonBot;
public static final fun commonChannelDirectMessagesContentMessageOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/CommonChannelDirectMessagesContentMessage;
@@ -1298,6 +1304,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun commonPassportOrThrow (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;)Ldev/inmo/tgbotapi/types/passport/encrypted/CommonPassport;
public static final fun commonPassportSecureValueOrNull (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;)Ldev/inmo/tgbotapi/types/passport/decrypted/CommonPassportSecureValue;
public static final fun commonPassportSecureValueOrThrow (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;)Ldev/inmo/tgbotapi/types/passport/decrypted/CommonPassportSecureValue;
public static final fun commonRequestExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/CommonRequestException;
public static final fun commonRequestExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/CommonRequestException;
public static final fun commonSuggestedChannelDirectMessagesContentMessageOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/CommonSuggestedChannelDirectMessagesContentMessage;
public static final fun commonSuggestedChannelDirectMessagesContentMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/CommonSuggestedChannelDirectMessagesContentMessage;
public static final fun commonSuggestedChannelDirectMessagesContentMessageOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/CommonSuggestedChannelDirectMessagesContentMessage;
@@ -1506,6 +1514,10 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun fromChannelSuggestedChannelDirectMessagesContentMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/FromChannelSuggestedChannelDirectMessagesContentMessage;
public static final fun fromSupergroupOrNull (Ldev/inmo/tgbotapi/types/message/ForwardInfo;)Ldev/inmo/tgbotapi/types/message/ForwardInfo$PublicChat$FromSupergroup;
public static final fun fromSupergroupOrThrow (Ldev/inmo/tgbotapi/types/message/ForwardInfo;)Ldev/inmo/tgbotapi/types/message/ForwardInfo$PublicChat$FromSupergroup;
public static final fun fromUserChatMessageOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/FromUserChatMessage;
public static final fun fromUserChatMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/FromUserChatMessage;
public static final fun fromUserChatMessageOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/FromUserChatMessage;
public static final fun fromUserChatMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/FromUserChatMessage;
public static final fun fromUserMessageOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/FromUserMessage;
public static final fun fromUserMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/FromUserMessage;
public static final fun fromUserMessageOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/FromUserMessage;
@@ -1520,6 +1532,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun generalForumTopicHiddenOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/forum/GeneralForumTopicHidden;
public static final fun generalForumTopicUnhiddenOrNull (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/forum/GeneralForumTopicUnhidden;
public static final fun generalForumTopicUnhiddenOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/forum/GeneralForumTopicUnhidden;
public static final fun getUpdatesConflictOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/GetUpdatesConflict;
public static final fun getUpdatesConflictOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/GetUpdatesConflict;
public static final fun giftCodeOrNull (Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource;)Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource$GiftCode;
public static final fun giftCodeOrThrow (Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource;)Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource$GiftCode;
public static final fun giftSentOrReceivedEventOrNull (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/gifts/GiftSentOrReceivedEvent;
@@ -1572,10 +1586,6 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun groupEventMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/GroupEventMessage;
public static final fun groupEventOrNull (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/GroupEvent;
public static final fun groupEventOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/GroupEvent;
public static final fun guestContentMessageOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/GuestContentMessage;
public static final fun guestContentMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/GuestContentMessage;
public static final fun guestContentMessageOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/GuestContentMessage;
public static final fun guestContentMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/GuestContentMessage;
public static final fun guestMessageUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/GuestMessageUpdate;
public static final fun guestMessageUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/GuestMessageUpdate;
public static final fun hashTagTextSourceOrNull (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/HashTagTextSource;
@@ -1602,6 +1612,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifAnonymousForumContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifAnonymousGroupContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifAny (Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifApiException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifApproximateScheduledCloseInfo (Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifAudioContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifAudioFile (Ldev/inmo/tgbotapi/types/media/BaseTelegramMediaFile;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1689,6 +1700,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifCodeTextSource (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommon (Ldev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonBot (Ldev/inmo/tgbotapi/types/chat/Chat;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonBotException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonBotExceptionDefault (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonChannelDirectMessagesContentMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonChannelDirectMessagesContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonChannelDirectMessagesEventMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1704,6 +1717,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifCommonGroupEventMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonPassport (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonPassportSecureValue (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonRequestException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonSuggestedChannelDirectMessagesContentMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonSuggestedChannelDirectMessagesContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifCommonSupergroupEventMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1809,12 +1823,15 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifFromChannelSuggestedChannelDirectMessagesContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifFromSupergroup (Ldev/inmo/tgbotapi/types/message/ForwardInfo;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifFromUser (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifFromUserChatMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifFromUserChatMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifFromUserMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifFromUserMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGameContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGameShortNameCallbackQuery (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGeneralForumTopicHidden (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGeneralForumTopicUnhidden (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGetUpdatesConflict (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGiftCode (Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGiftSentOrReceivedEvent (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGiftSentOrReceivedEventReceivedInBusinessAccount (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1841,8 +1858,6 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifGroupEvent (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGroupEventMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGroupEventMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGuestContentMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGuestContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGuestMessageUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifHashTagTextSource (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifIdChatIdentifier (Ldev/inmo/tgbotapi/types/ChatIdentifier;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1891,17 +1906,20 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifInputInvoiceMessageContent (Ldev/inmo/tgbotapi/abstracts/CommonSendInvoiceData;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInputInvoiceMessageContent (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInputLocationMessageContent (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInputRichMessageContent (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInputTextMessageContent (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInputVenueMessageContent (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInternal (Ldev/inmo/tgbotapi/types/ReplyInfo;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInternalPassport (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInternalPassportSecureValue (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInvalidPhotoDimensionsException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifInvoiceContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifItalicTextSource (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifKickedChatMember (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifLeftChatMember (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifLeftChatMemberEvent (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifLeftChatMemberEvent (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifLink (Ldev/inmo/tgbotapi/types/media/BaseTelegramMediaFile;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifLiveLocation (Ldev/inmo/tgbotapi/types/location/Location;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifLiveLocationContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifLivePhotoContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1931,6 +1949,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifMessageContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifMessageDataCallbackQuery (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifMessageGameShortNameCallbackQuery (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifMessageIsNotModifiedException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifMessageToEditNotFoundException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifMessageUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifMigratedToSupergroup (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifMimedMediaFile (Ldev/inmo/tgbotapi/types/media/BaseTelegramMediaFile;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1996,6 +2016,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifPollUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyEditedMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyForwardedMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyGuestAnswerMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyMediaGroupMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyOfflineMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyPaidMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -2055,8 +2076,63 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifReplyForce (Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifReplyKeyboardMarkup (Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifReplyKeyboardRemove (Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifReplyMessageNotFoundException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRequestException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRequestGuestContentMessage (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRequestGuestContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRequestGuestMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRestrictedChatMember (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRestrictedMemberChatMember (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockAnchor (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockAnimation (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockAudio (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockBlockQuotation (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockCollage (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockDetails (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockDivider (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockFooter (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockList (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockMap (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockMathematicalExpression (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockParagraph (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockPhoto (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockPreformatted (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockPullQuotation (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockSectionHeading (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockSlideshow (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockTable (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockThinking (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockVideo (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichBlockVoiceNote (Ldev/inmo/tgbotapi/types/rich/RichBlock;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichMessageContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextAnchor (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextAnchorLink (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextBankCardNumber (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextBold (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextBotCommand (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextCashtag (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextCode (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextCustomEmoji (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextDateTime (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextEmailAddress (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextEntity (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextGroup (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextHashtag (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextItalic (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextMarked (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextMathematicalExpression (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextMention (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextPhoneNumber (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextPlain (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextReference (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextReferenceLink (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextSpoiler (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextStrikethrough (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextSubscript (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextSuperscript (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextTextMention (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextUnderline (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifRichTextUrl (Ldev/inmo/tgbotapi/types/rich/RichText;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifSecondaryChatInviteLink (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifSecureValueIdentity (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifSecureValueWithData (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -2118,6 +2194,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifTelegramMediaDocument (Ldev/inmo/tgbotapi/types/media/InputPollMedia;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTelegramMediaDocument (Ldev/inmo/tgbotapi/types/media/TelegramMedia;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTelegramMediaFile (Ldev/inmo/tgbotapi/types/media/BaseTelegramMediaFile;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTelegramMediaLink (Ldev/inmo/tgbotapi/types/media/InputPollOptionMedia;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTelegramMediaLivePhoto (Ldev/inmo/tgbotapi/types/media/InputPollMedia;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTelegramMediaLivePhoto (Ldev/inmo/tgbotapi/types/media/InputPollOptionMedia;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTelegramMediaLivePhoto (Ldev/inmo/tgbotapi/types/media/TelegramMedia;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -2152,9 +2229,11 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifTitledInlineQueryResult (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTitledTelegramMedia (Ldev/inmo/tgbotapi/types/media/TelegramMedia;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifToStory (Ldev/inmo/tgbotapi/types/ReplyInfo;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTooMuchRequestsException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifTypingAction (Ldev/inmo/tgbotapi/types/actions/BotAction;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifURLInlineKeyboardButton (Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifURLTextSource (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifUnauthorizedException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifUnconnectedFromChannelGroupContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifUnderlineTextSource (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifUnknown (Ldev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -2229,6 +2308,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifWriteAccessAllowedFromRequest (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifWriteAccessAllowedFromWebAppLink (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifWriteAccessAllowedOther (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifWrongFileIdentifierException (Ldev/inmo/tgbotapi/bot/exceptions/BotException;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun inaccessibleMessageCallbackQueryOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/queries/callback/InaccessibleMessageCallbackQuery;
public static final fun inaccessibleMessageCallbackQueryOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/queries/callback/InaccessibleMessageCallbackQuery;
public static final fun inaccessibleMessageDataCallbackQueryOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/queries/callback/InaccessibleMessageDataCallbackQuery;
@@ -2313,6 +2393,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun inputInvoiceMessageContentOrThrow (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputInvoiceMessageContent;
public static final fun inputLocationMessageContentOrNull (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputLocationMessageContent;
public static final fun inputLocationMessageContentOrThrow (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputLocationMessageContent;
public static final fun inputRichMessageContentOrNull (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputRichMessageContent;
public static final fun inputRichMessageContentOrThrow (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputRichMessageContent;
public static final fun inputTextMessageContentOrNull (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent;
public static final fun inputTextMessageContentOrThrow (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent;
public static final fun inputVenueMessageContentOrNull (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputVenueMessageContent;
@@ -2323,6 +2405,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun internalPassportOrThrow (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;)Ldev/inmo/tgbotapi/types/passport/encrypted/InternalPassport;
public static final fun internalPassportSecureValueOrNull (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;)Ldev/inmo/tgbotapi/types/passport/decrypted/InternalPassportSecureValue;
public static final fun internalPassportSecureValueOrThrow (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;)Ldev/inmo/tgbotapi/types/passport/decrypted/InternalPassportSecureValue;
public static final fun invalidPhotoDimensionsExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/InvalidPhotoDimensionsException;
public static final fun invalidPhotoDimensionsExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/InvalidPhotoDimensionsException;
public static final fun invoiceContentOrNull (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/InvoiceContent;
public static final fun invoiceContentOrThrow (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/InvoiceContent;
public static final fun italicTextSourceOrNull (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/ItalicTextSource;
@@ -2335,6 +2419,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun leftChatMemberEventOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/LeftChatMemberEvent;
public static final fun leftChatMemberOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/member/LeftChatMember;
public static final fun leftChatMemberOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/member/LeftChatMember;
public static final fun linkOrNull (Ldev/inmo/tgbotapi/types/media/BaseTelegramMediaFile;)Ldev/inmo/tgbotapi/types/Link;
public static final fun linkOrThrow (Ldev/inmo/tgbotapi/types/media/BaseTelegramMediaFile;)Ldev/inmo/tgbotapi/types/Link;
public static final fun liveLocationContentOrNull (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/LiveLocationContent;
public static final fun liveLocationContentOrThrow (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/LiveLocationContent;
public static final fun liveLocationOrNull (Ldev/inmo/tgbotapi/types/location/Location;)Ldev/inmo/tgbotapi/types/location/LiveLocation;
@@ -2393,6 +2479,10 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun messageDataCallbackQueryOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/queries/callback/MessageDataCallbackQuery;
public static final fun messageGameShortNameCallbackQueryOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/queries/callback/MessageGameShortNameCallbackQuery;
public static final fun messageGameShortNameCallbackQueryOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/queries/callback/MessageGameShortNameCallbackQuery;
public static final fun messageIsNotModifiedExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/MessageIsNotModifiedException;
public static final fun messageIsNotModifiedExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/MessageIsNotModifiedException;
public static final fun messageToEditNotFoundExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/MessageToEditNotFoundException;
public static final fun messageToEditNotFoundExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/MessageToEditNotFoundException;
public static final fun messageUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/MessageUpdate;
public static final fun messageUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/MessageUpdate;
public static final fun migratedToSupergroupOrNull (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/MigratedToSupergroup;
@@ -2523,6 +2613,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun possiblyEditedMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyEditedMessage;
public static final fun possiblyForwardedMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyForwardedMessage;
public static final fun possiblyForwardedMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyForwardedMessage;
public static final fun possiblyGuestAnswerMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyGuestAnswerMessage;
public static final fun possiblyGuestAnswerMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyGuestAnswerMessage;
public static final fun possiblyMediaGroupMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyMediaGroupMessage;
public static final fun possiblyMediaGroupMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyMediaGroupMessage;
public static final fun possiblyOfflineMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyOfflineMessage;
@@ -2641,10 +2733,120 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun replyKeyboardMarkupOrThrow (Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/types/buttons/ReplyKeyboardMarkup;
public static final fun replyKeyboardRemoveOrNull (Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/types/buttons/ReplyKeyboardRemove;
public static final fun replyKeyboardRemoveOrThrow (Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/types/buttons/ReplyKeyboardRemove;
public static final fun replyMessageNotFoundExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/ReplyMessageNotFoundException;
public static final fun replyMessageNotFoundExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/ReplyMessageNotFoundException;
public static final fun requestExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/RequestException;
public static final fun requestExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/RequestException;
public static final fun requestGuestContentMessageOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/RequestGuestContentMessage;
public static final fun requestGuestContentMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/RequestGuestContentMessage;
public static final fun requestGuestContentMessageOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/RequestGuestContentMessage;
public static final fun requestGuestContentMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/RequestGuestContentMessage;
public static final fun requestGuestMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/RequestGuestMessage;
public static final fun requestGuestMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/RequestGuestMessage;
public static final fun restrictedChatMemberOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/member/RestrictedChatMember;
public static final fun restrictedChatMemberOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/member/RestrictedChatMember;
public static final fun restrictedMemberChatMemberOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/member/RestrictedMemberChatMember;
public static final fun restrictedMemberChatMemberOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/member/RestrictedMemberChatMember;
public static final fun richBlockAnchorOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockAnchor;
public static final fun richBlockAnchorOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockAnchor;
public static final fun richBlockAnimationOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockAnimation;
public static final fun richBlockAnimationOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockAnimation;
public static final fun richBlockAudioOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockAudio;
public static final fun richBlockAudioOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockAudio;
public static final fun richBlockBlockQuotationOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockBlockQuotation;
public static final fun richBlockBlockQuotationOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockBlockQuotation;
public static final fun richBlockCollageOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockCollage;
public static final fun richBlockCollageOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockCollage;
public static final fun richBlockDetailsOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockDetails;
public static final fun richBlockDetailsOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockDetails;
public static final fun richBlockDividerOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockDivider;
public static final fun richBlockDividerOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockDivider;
public static final fun richBlockFooterOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockFooter;
public static final fun richBlockFooterOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockFooter;
public static final fun richBlockListOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockList;
public static final fun richBlockListOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockList;
public static final fun richBlockMapOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockMap;
public static final fun richBlockMapOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockMap;
public static final fun richBlockMathematicalExpressionOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockMathematicalExpression;
public static final fun richBlockMathematicalExpressionOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockMathematicalExpression;
public static final fun richBlockParagraphOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockParagraph;
public static final fun richBlockParagraphOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockParagraph;
public static final fun richBlockPhotoOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockPhoto;
public static final fun richBlockPhotoOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockPhoto;
public static final fun richBlockPreformattedOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockPreformatted;
public static final fun richBlockPreformattedOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockPreformatted;
public static final fun richBlockPullQuotationOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockPullQuotation;
public static final fun richBlockPullQuotationOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockPullQuotation;
public static final fun richBlockSectionHeadingOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockSectionHeading;
public static final fun richBlockSectionHeadingOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockSectionHeading;
public static final fun richBlockSlideshowOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockSlideshow;
public static final fun richBlockSlideshowOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockSlideshow;
public static final fun richBlockTableOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockTable;
public static final fun richBlockTableOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockTable;
public static final fun richBlockThinkingOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockThinking;
public static final fun richBlockThinkingOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockThinking;
public static final fun richBlockVideoOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockVideo;
public static final fun richBlockVideoOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockVideo;
public static final fun richBlockVoiceNoteOrNull (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockVoiceNote;
public static final fun richBlockVoiceNoteOrThrow (Ldev/inmo/tgbotapi/types/rich/RichBlock;)Ldev/inmo/tgbotapi/types/rich/RichBlockVoiceNote;
public static final fun richMessageContentOrNull (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/RichMessageContent;
public static final fun richMessageContentOrThrow (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/RichMessageContent;
public static final fun richTextAnchorLinkOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextAnchorLink;
public static final fun richTextAnchorLinkOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextAnchorLink;
public static final fun richTextAnchorOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextAnchor;
public static final fun richTextAnchorOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextAnchor;
public static final fun richTextBankCardNumberOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextBankCardNumber;
public static final fun richTextBankCardNumberOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextBankCardNumber;
public static final fun richTextBoldOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextBold;
public static final fun richTextBoldOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextBold;
public static final fun richTextBotCommandOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextBotCommand;
public static final fun richTextBotCommandOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextBotCommand;
public static final fun richTextCashtagOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextCashtag;
public static final fun richTextCashtagOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextCashtag;
public static final fun richTextCodeOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextCode;
public static final fun richTextCodeOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextCode;
public static final fun richTextCustomEmojiOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextCustomEmoji;
public static final fun richTextCustomEmojiOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextCustomEmoji;
public static final fun richTextDateTimeOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextDateTime;
public static final fun richTextDateTimeOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextDateTime;
public static final fun richTextEmailAddressOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextEmailAddress;
public static final fun richTextEmailAddressOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextEmailAddress;
public static final fun richTextEntityOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextEntity;
public static final fun richTextEntityOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextEntity;
public static final fun richTextGroupOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextGroup;
public static final fun richTextGroupOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextGroup;
public static final fun richTextHashtagOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextHashtag;
public static final fun richTextHashtagOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextHashtag;
public static final fun richTextItalicOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextItalic;
public static final fun richTextItalicOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextItalic;
public static final fun richTextMarkedOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextMarked;
public static final fun richTextMarkedOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextMarked;
public static final fun richTextMathematicalExpressionOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextMathematicalExpression;
public static final fun richTextMathematicalExpressionOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextMathematicalExpression;
public static final fun richTextMentionOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextMention;
public static final fun richTextMentionOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextMention;
public static final fun richTextPhoneNumberOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextPhoneNumber;
public static final fun richTextPhoneNumberOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextPhoneNumber;
public static final fun richTextPlainOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextPlain;
public static final fun richTextPlainOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextPlain;
public static final fun richTextReferenceLinkOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextReferenceLink;
public static final fun richTextReferenceLinkOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextReferenceLink;
public static final fun richTextReferenceOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextReference;
public static final fun richTextReferenceOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextReference;
public static final fun richTextSpoilerOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextSpoiler;
public static final fun richTextSpoilerOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextSpoiler;
public static final fun richTextStrikethroughOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextStrikethrough;
public static final fun richTextStrikethroughOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextStrikethrough;
public static final fun richTextSubscriptOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextSubscript;
public static final fun richTextSubscriptOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextSubscript;
public static final fun richTextSuperscriptOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextSuperscript;
public static final fun richTextSuperscriptOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextSuperscript;
public static final fun richTextTextMentionOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextTextMention;
public static final fun richTextTextMentionOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextTextMention;
public static final fun richTextUnderlineOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextUnderline;
public static final fun richTextUnderlineOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextUnderline;
public static final fun richTextUrlOrNull (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextUrl;
public static final fun richTextUrlOrThrow (Ldev/inmo/tgbotapi/types/rich/RichText;)Ldev/inmo/tgbotapi/types/rich/RichTextUrl;
public static final fun secondaryChatInviteLinkOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/SecondaryChatInviteLink;
public static final fun secondaryChatInviteLinkOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/SecondaryChatInviteLink;
public static final fun secureValueIdentityOrNull (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;)Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValueIdentity;
@@ -2767,6 +2969,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun telegramMediaDocumentOrThrow (Ldev/inmo/tgbotapi/types/media/TelegramMedia;)Ldev/inmo/tgbotapi/types/media/TelegramMediaDocument;
public static final fun telegramMediaFileOrNull (Ldev/inmo/tgbotapi/types/media/BaseTelegramMediaFile;)Ldev/inmo/tgbotapi/types/files/TelegramMediaFile;
public static final fun telegramMediaFileOrThrow (Ldev/inmo/tgbotapi/types/media/BaseTelegramMediaFile;)Ldev/inmo/tgbotapi/types/files/TelegramMediaFile;
public static final fun telegramMediaLinkOrNull (Ldev/inmo/tgbotapi/types/media/InputPollOptionMedia;)Ldev/inmo/tgbotapi/types/media/TelegramMediaLink;
public static final fun telegramMediaLinkOrThrow (Ldev/inmo/tgbotapi/types/media/InputPollOptionMedia;)Ldev/inmo/tgbotapi/types/media/TelegramMediaLink;
public static final fun telegramMediaLivePhotoOrNull (Ldev/inmo/tgbotapi/types/media/InputPollMedia;)Ldev/inmo/tgbotapi/types/media/TelegramMediaLivePhoto;
public static final fun telegramMediaLivePhotoOrNull (Ldev/inmo/tgbotapi/types/media/InputPollOptionMedia;)Ldev/inmo/tgbotapi/types/media/TelegramMediaLivePhoto;
public static final fun telegramMediaLivePhotoOrNull (Ldev/inmo/tgbotapi/types/media/TelegramMedia;)Ldev/inmo/tgbotapi/types/media/TelegramMediaLivePhoto;
@@ -2835,12 +3039,16 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun titledTelegramMediaOrThrow (Ldev/inmo/tgbotapi/types/media/TelegramMedia;)Ldev/inmo/tgbotapi/types/media/TitledTelegramMedia;
public static final fun toStoryOrNull (Ldev/inmo/tgbotapi/types/ReplyInfo;)Ldev/inmo/tgbotapi/types/ReplyInfo$ToStory;
public static final fun toStoryOrThrow (Ldev/inmo/tgbotapi/types/ReplyInfo;)Ldev/inmo/tgbotapi/types/ReplyInfo$ToStory;
public static final fun tooMuchRequestsExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/TooMuchRequestsException;
public static final fun tooMuchRequestsExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/TooMuchRequestsException;
public static final fun typingActionOrNull (Ldev/inmo/tgbotapi/types/actions/BotAction;)Ldev/inmo/tgbotapi/types/actions/TypingAction;
public static final fun typingActionOrThrow (Ldev/inmo/tgbotapi/types/actions/BotAction;)Ldev/inmo/tgbotapi/types/actions/TypingAction;
public static final fun uRLInlineKeyboardButtonOrNull (Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton;)Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/URLInlineKeyboardButton;
public static final fun uRLInlineKeyboardButtonOrThrow (Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton;)Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/URLInlineKeyboardButton;
public static final fun uRLTextSourceOrNull (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/URLTextSource;
public static final fun uRLTextSourceOrThrow (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/URLTextSource;
public static final fun unauthorizedExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/UnauthorizedException;
public static final fun unauthorizedExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/UnauthorizedException;
public static final fun unconnectedFromChannelGroupContentMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/UnconnectedFromChannelGroupContentMessage;
public static final fun unconnectedFromChannelGroupContentMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/UnconnectedFromChannelGroupContentMessage;
public static final fun underlineTextSourceOrNull (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource;
@@ -2989,6 +3197,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun writeAccessAllowedOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/forum/WriteAccessAllowed;
public static final fun writeAccessAllowedOtherOrNull (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/forum/WriteAccessAllowed$Other;
public static final fun writeAccessAllowedOtherOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/forum/WriteAccessAllowed$Other;
public static final fun wrongFileIdentifierExceptionOrNull (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/WrongFileIdentifierException;
public static final fun wrongFileIdentifierExceptionOrThrow (Ldev/inmo/tgbotapi/bot/exceptions/BotException;)Ldev/inmo/tgbotapi/bot/exceptions/WrongFileIdentifierException;
}
public final class dev/inmo/tgbotapi/extensions/utils/CommonMessageConversationsKt {
@@ -3011,6 +3221,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ContentMessageConversation
public static final fun onlyLocationContentMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
public static final fun onlyPhotoContentMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
public static final fun onlyPollContentMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
public static final fun onlyRichMessageContentMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
public static final fun onlyStickerContentMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
public static final fun onlyStoryContentMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
public static final fun onlyTextContentMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
@@ -3204,6 +3415,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/extensions/raw/CallbackQue
public final class dev/inmo/tgbotapi/extensions/utils/extensions/raw/ChatJoinRequestKt {
public static final fun getInvite_link (Ldev/inmo/tgbotapi/types/chat/ChatJoinRequest;)Ldev/inmo/tgbotapi/types/ChatInviteLink;
public static final fun getQuery_id (Ldev/inmo/tgbotapi/types/chat/ChatJoinRequest;)Ljava/lang/String;
}
public final class dev/inmo/tgbotapi/extensions/utils/extensions/raw/ChatMemberUpdatedKt {
@@ -3246,6 +3458,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/extensions/raw/MessageKt {
public static final fun getFrom (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/chat/User;
public static final fun getGame (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/games/Game;
public static final fun getGroup_chat_created (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Z
public static final fun getGuest_bot_caller_chat (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/chat/PreviewChat;
public static final fun getGuest_bot_caller_user (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/chat/PreviewUser;
public static final fun getHas_protected_content (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ljava/lang/Boolean;
public static final fun getInvoice (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/payments/Invoice;
public static final fun getLeft_chat_member (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/chat/User;

View File

@@ -22,6 +22,7 @@ fun Flow<ContentMessage<*>>.onlyPollContentMessages() = withContentType<PollCont
fun Flow<ContentMessage<*>>.onlyStickerContentMessages() = withContentType<StickerContent>()
fun Flow<ContentMessage<*>>.onlyTextContentMessages() = withContentType<TextContent>()
fun Flow<ContentMessage<*>>.onlyStoryContentMessages() = withContentType<StoryContent>()
fun Flow<ContentMessage<*>>.onlyRichMessageContentMessages() = withContentType<RichMessageContent>()
fun Flow<ContentMessage<*>>.onlyVenueContentMessages() = withContentType<VenueContent>()
fun Flow<ContentMessage<*>>.onlyVideoContentMessages() = withContentType<VideoContent>()
fun Flow<ContentMessage<*>>.onlyLivePhotoContentMessages() = withContentType<LivePhotoContent>()

View File

@@ -1,9 +1,14 @@
package dev.inmo.tgbotapi.extensions.utils.extensions.raw
import dev.inmo.tgbotapi.types.ChatInviteLink
import dev.inmo.tgbotapi.types.ChatJoinRequestQueryId
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning)
val ChatJoinRequest.invite_link: ChatInviteLink?
get() = inviteLink
@RiskFeature(RawFieldsUsageWarning)
val ChatJoinRequest.query_id: ChatJoinRequestQueryId?
get() = queryId

View File

@@ -208,3 +208,11 @@ inline val Message.passport_data: PassportData?
@RiskFeature(RawFieldsUsageWarning)
inline val Message.reply_markup: InlineKeyboardMarkup?
get() = asCommonMessage() ?.replyMarkup
@RiskFeature(RawFieldsUsageWarning)
inline val Message.guest_bot_caller_user: PreviewUser?
get() = possiblyGuestAnswerMessageOrNull() ?.guestBotCallerUser
@RiskFeature(RawFieldsUsageWarning)
inline val Message.guest_bot_caller_chat: PreviewChat?
get() = possiblyGuestAnswerMessageOrNull() ?.guestBotCallerChat