diff --git a/.gitignore b/.gitignore index 4c51e26274..1f0b9177f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea .vscode/ +.junie/ .kotlin out/* *.iml diff --git a/CHANGELOG.md b/CHANGELOG.md index 065dfe5dd0..ed96c0105b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,47 +2,70 @@ ## 34.0.0 -* `Core` (Bots API support — Live Photos): - * Added `LivePhotoFile` class representing the incoming `LivePhoto` Telegram type (`PollMedia`, `MediaContentVariant`, `UsefulAsPaidMediaFile`) - * Added `LivePhotoContent` (`VisualMediaGroupPartContent`) representing live photo messages - * Added `TelegramMediaLivePhoto` (`TelegramFreeMedia`, `VisualMediaGroupMemberTelegramMedia`, `InputPollMedia`, `InputPollOptionMedia`) — usable in `sendMediaGroup`, `editMessageMedia`, and polls - * Added `TelegramPaidMediaLivePhoto` (`VisualTelegramPaidMedia`) for paid live photos - * Added `PaidMedia.LivePhoto` variant and `PaidMedia.LivePhoto.toTelegramPaidMediaLivePhoto()` conversion - * Added `livePhotoField` constant; added `live_photo` parsing to `RawMessage` and `ReplyInfo.External` surrogate - * Added `SendLivePhoto` request and `SendLivePhotoData`/`SendLivePhotoFiles` - * Added `LivePhotoMessage` typealias - * Added `LivePhotoFile.toTelegramMediaLivePhoto(...)` and `LivePhotoFile.toTelegramPaidMediaLivePhoto()` extensions -* `API` (Bots API support — Live Photos): - * Added `sendLivePhoto` extensions (`ChatIdentifier`/`Chat` × `InputFile`/`LivePhotoFile` × text/textSources) -* `Behaviour Builder` (Bots API support — Live Photos): - * Added `onLivePhoto`, `onEditedLivePhoto`, `onLivePhotoGalleryMessages`, `onLivePhotoGallery` triggers - * Added `onMentionWithLivePhotoContent`/`onTextMentionWithLivePhotoContent` triggers - * Added `waitLivePhoto`, `waitLivePhotoMessage`, `waitEditedLivePhoto`, `waitEditedLivePhotoMessage`, `waitLivePhotoGallery`, `waitLivePhotoGalleryMessages` expectations - * Added `onlyLivePhotoContentMessages` utility * `Core`: - * Added `canReactToMessages` field to `ChatPermissions` (interface, `Granular` and `Common`) and `RestrictedMemberChatMember` - * Added optional `retrieveOtherBots` parameter to `GetChatAdministrators` request - * Added `DeleteMessageReaction` request with `@Warning` on primary constructor; added `DeleteUserMessageReaction` and `DeleteActorChatMessageReaction` factory functions - * Added `DeleteAllMessageReactions` request with `@Warning` on primary constructor; added `DeleteAllUserMessageReactions` and `DeleteAllActorChatMessageReactions` factory functions + * (`Guest Mode`) Added `GuestQueryId` value class and `WithOptionalGuestQueryId` interface in `dev.inmo.tgbotapi.abstracts.types` + * (`Guest Mode`) Added `GuestMessage` and `GuestContentMessage` message abstractions (`SpecialMessage`, `CommonContentMessage`, `FromUserMessage`, `PossiblySentViaBot`) exposing `guestQueryId`, `guestBotCallerUser`, `guestBotCallerChat` + * (`Guest Mode`) Added `GuestContentMessageImpl` data class implementing `GuestContentMessage` + * (`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` + * Introduced sealed `ChatContentMessage` super-type extending `CommonContentMessage` and `ChatMessage`, used as the common return type of chat send/reply operations + * Reworked `ContentMessage`, `Message`, `FromUserMessage`, `PossiblyEditedMessage`, `PossiblyForwardedMessage`, `PossiblyPaymentMessage`, `PossiblySentViaBotCommonMessage`, `PossiblyTopicMessage`, `SignedMessage`, `ChatEventMessage`, `PassportMessage` and related typealiases to integrate guest messages and unify chat content messages + * Updated `RawMessage`, `MessageUpdate`, `ChannelPostUpdate`, `BusinessMessageUpdate`, `EditMessageUpdate`, `EditChannelPostUpdate`, `BaseMessageUpdate`, `BaseEditMessageUpdate`, `BaseSentMessageUpdate` to align with the new hierarchy + * (`Live Photos`) Added `LivePhotoFile` class representing the incoming `LivePhoto` Telegram type (`PollMedia`, `MediaContentVariant`, `UsefulAsPaidMediaFile`) + * (`Live Photos`) Added `LivePhotoContent` (`VisualMediaGroupPartContent`) representing live photo messages + * (`Live Photos`) Added `TelegramMediaLivePhoto` (`TelegramFreeMedia`, `VisualMediaGroupMemberTelegramMedia`, `InputPollMedia`, `InputPollOptionMedia`) — usable in `sendMediaGroup`, `editMessageMedia`, and polls + * (`Live Photos`) Added `TelegramPaidMediaLivePhoto` (`VisualTelegramPaidMedia`) for paid live photos + * (`Live Photos`) Added `PaidMedia.LivePhoto` variant and `PaidMedia.LivePhoto.toTelegramPaidMediaLivePhoto()` conversion + * (`Live Photos`) Added `livePhotoField` constant; added `live_photo` parsing to `RawMessage` and `ReplyInfo.External` surrogate + * (`Live Photos`) Added `SendLivePhoto` request and `SendLivePhotoData`/`SendLivePhotoFiles` + * (`Live Photos`) Added `LivePhotoMessage` typealias + * (`Live Photos`) Added `LivePhotoFile.toTelegramMediaLivePhoto(...)` and `LivePhotoFile.toTelegramPaidMediaLivePhoto()` extensions + * (`Chat Management`) Added `canReactToMessages` field to `ChatPermissions` (interface, `Granular` and `Common`) and `RestrictedMemberChatMember` + * (`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 `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` + * (`Polls`) Added `explanationMedia` field to `QuizPoll` + * (`Polls`) Added `membersOnly` field to `Poll` + * (`Polls`) Added `countryCodes` field to `Poll` + * (`Polls`) Added `media`, `membersOnly`, `countryCodes` parameters to `SendRegularPoll` and `SendPoll` factory functions + * (`Polls`) Added `media`, `explanationMedia`, `membersOnly`, `countryCodes` parameters to `SendQuizPoll` factory functions + * (`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 `isAccessRestrictedField`, `addedUsersField`, `addedUserIdsField` constants + * (`Personal Chat`) Added `GetUserPersonalChatMessages` request returning `List>` + * (`Drafts`) `SendMessageDraft.text` and matching factory `text` parameter became nullable to allow empty/absent text (renders "Thinking…" placeholder) * `API`: - * Added optional `retrieveOtherBots` parameter to `getChatAdministrators` extensions - * Added `deleteUserMessageReaction` and `deleteActorChatMessageReaction` extensions - * Added `deleteAllUserMessageReactions` and `deleteAllActorChatMessageReactions` extensions - * Added `@Warning`-marked catch-all `deleteMessageReaction` and `deleteAllMessageReactions` extensions -* `Core` (Bots API support): - * Added `InputMediaSticker`, `InputMediaLocation` and `InputMediaVenue` classes - * Added `InputPollMedia` and `InputPollOptionMedia` sealed interfaces representing input media variants accepted by `sendPoll` - * Added `PollMedia` class representing media attached to polls in incoming updates - * Added `media` field to `Poll`, `PollOption` and `InputPollOption` - * Added `explanationMedia` field to `QuizPoll` - * Added `membersOnly` field to `Poll` - * Added `countryCodes` field to `Poll` - * Added `media`, `membersOnly`, `countryCodes` parameters to `SendRegularPoll` and `SendPoll` factory functions - * Added `media`, `explanationMedia`, `membersOnly`, `countryCodes` parameters to `SendQuizPoll` factory functions - * Decreased minimum allowed poll options count from 2 to 1 (`pollOptionsLimit` is now `1..12`) -* `API` (Bots API support): - * Added `media`, `membersOnly`, `countryCodes` parameters to `sendRegularPoll` extension - * Added `media`, `explanationMedia`, `membersOnly`, `countryCodes` parameters to `sendQuizPoll` extension + * (`Guest Mode`) Added `answerGuestQuery` extensions in `dev.inmo.tgbotapi.extensions.api.answers` + * (`Guest Mode`) Added `RepliesWithGuestQueryId.kt` reply extensions accepting `GuestQueryId` + * (`Guest Mode`) Updated reply/send extensions (`Replies`, `RepliesWithChatsAndMessages`, `Sends`, `ResendMessage`, `SendChecklist`, `SendContact`, `SendDice`, `SendLiveLocation`, `SendStaticLocation`, `SendVenue`, `SendMessage`, media `Send*`, `SendGame`, `SendInvoice`, `SendQuizPoll`, `SendRegularPoll`) to return `ChatContentMessage<*>` and align with the new hierarchy + * (`Live Photos`) Added `sendLivePhoto` extensions (`ChatIdentifier`/`Chat` × `InputFile`/`LivePhotoFile` × text/textSources) + * (`Chat Management`) Added optional `retrieveOtherBots` parameter to `getChatAdministrators` extensions + * (`Chat Management`) Added `deleteUserMessageReaction` and `deleteActorChatMessageReaction` extensions + * (`Chat Management`) Added `deleteAllUserMessageReactions` and `deleteAllActorChatMessageReactions` extensions + * (`Chat Management`) Added `@Warning`-marked catch-all `deleteMessageReaction` and `deleteAllMessageReactions` extensions + * (`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>` + * (`Drafts`) `sendMessageDraft` and `send` overloads for drafts now accept nullable `text: String?` +* `Behaviour Builder`: + * (`Guest Mode`) Added `GuestMessageTriggers` with `onGuestMessage` 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 ## 33.1.0 diff --git a/agents/HELPERS.md b/agents/HELPERS.md index 7e35572210..c75169f992 100644 --- a/agents/HELPERS.md +++ b/agents/HELPERS.md @@ -20,3 +20,31 @@ If you are adding `Send*` request - you also must add in `API` (`tgbotapi.api`) * Bindings in [Sends.kt](../tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt) * Bindings in [Replies.kt](../tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt) * Bindings in [RepliesWithChatsAndMessages.kt](../tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt) + +--- + +When you need to fill a changelog, you must follow the common changelog style: + +```markdown +## 34.0.0 // number of version +* `Core`: + * // list of changes +* `Utils`: + * // list of changes +* `API`: + * // list of changes +* `BehaviourBuilder`: + * // list of changes +* `WebApps`: + * // list of changes +* `BehaviourBuilderWithFSM`: + * // list of changes +// etc... +``` + +Each section can be ommited if there are no any changes in the section. In case of filling some known telegram bots api changelog part - you may add previx with its title in point with change. For example: + +```markdown +* `Core`: + * (`Guest mode`) // change data +``` diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index 84be62f78a..bb086424aa 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -149,6 +149,10 @@ public final class dev/inmo/tgbotapi/extensions/api/GetUpdatesRawKt { public static synthetic fun getRawUpdates-Z6_7qMY$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/UpdateId;ILjava/lang/Integer;Ljava/util/List;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } +public final class dev/inmo/tgbotapi/extensions/api/GetUserPersonalChatMessagesKt { + public static final fun getUserPersonalChatMessages-nc95W0g (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JILkotlin/coroutines/Continuation;)Ljava/lang/Object; +} + public final class dev/inmo/tgbotapi/extensions/api/LiveFlowLocationKt { public static final fun handleLiveLocation-Z2YO6e4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Lkotlinx/coroutines/flow/Flow;JLdev/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;Lkotlinx/coroutines/flow/FlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun handleLiveLocation-Z2YO6e4$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Lkotlinx/coroutines/flow/Flow;JLdev/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;Lkotlinx/coroutines/flow/FlowCollector;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; @@ -1280,6 +1284,10 @@ public final class dev/inmo/tgbotapi/extensions/api/inline/SavePreparedInlineMes public static synthetic fun savePreparedInlineMessage$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult;ZZZZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } +public final class dev/inmo/tgbotapi/extensions/api/managed_bots/GetManagedBotAccessSettingsKt { + public static final fun getManagedBotAccessSettings-dEpx-Zg (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLkotlin/coroutines/Continuation;)Ljava/lang/Object; +} + public final class dev/inmo/tgbotapi/extensions/api/managed_bots/GetManagedBotTokenKt { public static final fun getManagedBotToken-dEpx-Zg (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLkotlin/coroutines/Continuation;)Ljava/lang/Object; } @@ -1288,6 +1296,11 @@ public final class dev/inmo/tgbotapi/extensions/api/managed_bots/ReplaceManagedB public static final fun replaceManagedBotToken-dEpx-Zg (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLkotlin/coroutines/Continuation;)Ljava/lang/Object; } +public final class dev/inmo/tgbotapi/extensions/api/managed_bots/SetManagedBotAccessSettingsKt { + public static final fun setManagedBotAccessSettings-4iNBclM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JZLjava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun setManagedBotAccessSettings-4iNBclM$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JZLjava/util/List;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; +} + public final class dev/inmo/tgbotapi/extensions/api/passport/SetPassportDataErrorsKt { public static final fun setPassportDataErrors (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ldev/inmo/tgbotapi/types/passport/PassportData;Ldev/inmo/tgbotapi/utils/passport/Decryptor;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun setPassportDataErrors (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUserPersonalChatMessages.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUserPersonalChatMessages.kt new file mode 100644 index 0000000000..ac839f9c71 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUserPersonalChatMessages.kt @@ -0,0 +1,13 @@ +package dev.inmo.tgbotapi.extensions.api + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.GetUserPersonalChatMessages +import dev.inmo.tgbotapi.types.ChatId +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage + +public suspend fun TelegramBot.getUserPersonalChatMessages( + userId: ChatId, + limit: Int +): List> = execute( + GetUserPersonalChatMessages(userId = userId, limit = limit) +) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/managed_bots/GetManagedBotAccessSettings.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/managed_bots/GetManagedBotAccessSettings.kt new file mode 100644 index 0000000000..dfa477fb66 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/managed_bots/GetManagedBotAccessSettings.kt @@ -0,0 +1,12 @@ +package dev.inmo.tgbotapi.extensions.api.managed_bots + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.managed_bots.GetManagedBotAccessSettings +import dev.inmo.tgbotapi.types.ChatId +import dev.inmo.tgbotapi.types.managed_bots.BotAccessSettings + +public suspend fun TelegramBot.getManagedBotAccessSettings( + userId: ChatId +): BotAccessSettings = execute( + GetManagedBotAccessSettings(userId = userId) +) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/managed_bots/SetManagedBotAccessSettings.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/managed_bots/SetManagedBotAccessSettings.kt new file mode 100644 index 0000000000..cf0c9cff7e --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/managed_bots/SetManagedBotAccessSettings.kt @@ -0,0 +1,15 @@ +package dev.inmo.tgbotapi.extensions.api.managed_bots + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.managed_bots.SetManagedBotAccessSettings +import dev.inmo.tgbotapi.types.ChatId + +public suspend fun TelegramBot.setManagedBotAccessSettings( + userId: ChatId, + addedUserIds: List? = null +): Unit = execute( + SetManagedBotAccessSettings( + userId = userId, + addedUserIds = addedUserIds + ) +) diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 3081621de7..c07645be94 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -977,6 +977,38 @@ public final class dev/inmo/tgbotapi/requests/GetUpdatesRequest$DefaultImpls { public static fun method (Ldev/inmo/tgbotapi/requests/GetUpdatesRequest;)Ljava/lang/String; } +public final class dev/inmo/tgbotapi/requests/GetUserPersonalChatMessages : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { + public static final field Companion Ldev/inmo/tgbotapi/requests/GetUserPersonalChatMessages$Companion; + public synthetic fun (JILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-tHkBKVM ()J + public final fun component2 ()I + public final fun copy-zv9neSE (JI)Ldev/inmo/tgbotapi/requests/GetUserPersonalChatMessages; + public static synthetic fun copy-zv9neSE$default (Ldev/inmo/tgbotapi/requests/GetUserPersonalChatMessages;JIILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/GetUserPersonalChatMessages; + public fun equals (Ljava/lang/Object;)Z + public final fun getLimit ()I + public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; + public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public final fun getUserId-tHkBKVM ()J + public fun hashCode ()I + public fun method ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + +public final synthetic class dev/inmo/tgbotapi/requests/GetUserPersonalChatMessages$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/GetUserPersonalChatMessages$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/GetUserPersonalChatMessages; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/requests/GetUserPersonalChatMessages;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/GetUserPersonalChatMessages$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/inmo/tgbotapi/requests/SavePreparedKeyboardButton : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/SavePreparedKeyboardButton$Companion; public synthetic fun (JLdev/inmo/tgbotapi/types/buttons/KeyboardButton;Lkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -5812,6 +5844,36 @@ public final class dev/inmo/tgbotapi/requests/local/LogOut : dev/inmo/tgbotapi/r public final fun serializer ()Lkotlinx/serialization/KSerializer; } +public final class dev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { + public static final field Companion Ldev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings$Companion; + public synthetic fun (JLkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-tHkBKVM ()J + public final fun copy-HZVsHAI (J)Ldev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings; + public static synthetic fun copy-HZVsHAI$default (Ldev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings;JILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings; + public fun equals (Ljava/lang/Object;)Z + public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; + public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public final fun getUserId-tHkBKVM ()J + public fun hashCode ()I + public fun method ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + +public final synthetic class dev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/inmo/tgbotapi/requests/managed_bots/GetManagedBotToken : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/managed_bots/GetManagedBotToken$Companion; public synthetic fun (JLkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -5872,6 +5934,41 @@ public final class dev/inmo/tgbotapi/requests/managed_bots/ReplaceManagedBotToke public final fun serializer ()Lkotlinx/serialization/KSerializer; } +public final class dev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { + public static final field Companion Ldev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings$Companion; + public synthetic fun (JZLjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JZLjava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-tHkBKVM ()J + public final fun component2 ()Z + public final fun component3 ()Ljava/util/List; + public final fun copy-pU7KfLc (JZLjava/util/List;)Ldev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings; + public static synthetic fun copy-pU7KfLc$default (Ldev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings;JZLjava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings; + public fun equals (Ljava/lang/Object;)Z + public final fun getAddedUserIds ()Ljava/util/List; + public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; + public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public final fun getUserId-tHkBKVM ()J + public fun hashCode ()I + public final fun isAccessRestricted ()Z + public fun method ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + +public final synthetic class dev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/inmo/tgbotapi/requests/send/CopyMessage : dev/inmo/tgbotapi/abstracts/TextedOutput, dev/inmo/tgbotapi/abstracts/WithCustomStartMediaData, dev/inmo/tgbotapi/abstracts/types/MessageAction, dev/inmo/tgbotapi/abstracts/types/OptionallyWithEffectId, dev/inmo/tgbotapi/abstracts/types/ProtectContent, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest, dev/inmo/tgbotapi/requests/send/abstracts/OptionallyMessageThreadRequest, dev/inmo/tgbotapi/requests/send/abstracts/ReplyingMarkupSendMessageRequest, dev/inmo/tgbotapi/requests/send/abstracts/WithCustomizableCaptionRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/send/CopyMessage$Companion; public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/Integer;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -10759,6 +10856,8 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final field addedByChatField Ljava/lang/String; public static final field addedByUserField Ljava/lang/String; public static final field addedToAttachmentMenuField Ljava/lang/String; + public static final field addedUserIdsField Ljava/lang/String; + public static final field addedUsersField Ljava/lang/String; public static final field additionDateField Ljava/lang/String; public static final field additionalChatCountField Ljava/lang/String; public static final field addressField Ljava/lang/String; @@ -11042,6 +11141,7 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final field inviteLinkField Ljava/lang/String; public static final field invoicePayloadField Ljava/lang/String; public static final field ipAddressField Ljava/lang/String; + public static final field isAccessRestrictedField Ljava/lang/String; public static final field isAnimatedField Ljava/lang/String; public static final field isAnimationField Ljava/lang/String; public static final field isAnonymousField Ljava/lang/String; @@ -24066,6 +24166,36 @@ public final class dev/inmo/tgbotapi/types/location/StaticLocation$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } +public final class dev/inmo/tgbotapi/types/managed_bots/BotAccessSettings { + public static final field Companion Ldev/inmo/tgbotapi/types/managed_bots/BotAccessSettings$Companion; + public fun (ZLjava/util/List;)V + public synthetic fun (ZLjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Z + public final fun component2 ()Ljava/util/List; + public final fun copy (ZLjava/util/List;)Ldev/inmo/tgbotapi/types/managed_bots/BotAccessSettings; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/managed_bots/BotAccessSettings;ZLjava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/managed_bots/BotAccessSettings; + public fun equals (Ljava/lang/Object;)Z + public final fun getAddedUsers ()Ljava/util/List; + public fun hashCode ()I + public final fun isAccessRestricted ()Z + public fun toString ()Ljava/lang/String; +} + +public final synthetic class dev/inmo/tgbotapi/types/managed_bots/BotAccessSettings$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/managed_bots/BotAccessSettings$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/types/managed_bots/BotAccessSettings; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/types/managed_bots/BotAccessSettings;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/types/managed_bots/BotAccessSettings$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/inmo/tgbotapi/types/managed_bots/ManagedBotCreated : dev/inmo/tgbotapi/types/message/ChatEvents/abstracts/CommonEvent { public static final field Companion Ldev/inmo/tgbotapi/types/managed_bots/ManagedBotCreated$Companion; public fun (Ldev/inmo/tgbotapi/types/chat/PreviewBot;)V diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/GetUserPersonalChatMessages.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/GetUserPersonalChatMessages.kt new file mode 100644 index 0000000000..2bc60e9402 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/GetUserPersonalChatMessages.kt @@ -0,0 +1,43 @@ +package dev.inmo.tgbotapi.requests + +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.ChatId +import dev.inmo.tgbotapi.types.limitField +import dev.inmo.tgbotapi.types.message.RawMessage +import dev.inmo.tgbotapi.types.message.abstracts.ChatContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.ChatMessage +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.userIdField +import kotlinx.serialization.* +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder + +@Serializable +data class GetUserPersonalChatMessages( + @SerialName(userIdField) + val userId: ChatId, + @SerialName(limitField) + val limit: Int +) : SimpleRequest>> { + override fun method(): String = "getUserPersonalChatMessages" + override val resultDeserializer: DeserializationStrategy>> + get() = resultSerializer + override val requestSerializer: SerializationStrategy<*> + get() = serializer() + + private object MessagesDeserializer : DeserializationStrategy>> { + private val rawListSerializer = ListSerializer(RawMessage.serializer()) + override val descriptor: SerialDescriptor = rawListSerializer.descriptor + @Suppress("UNCHECKED_CAST") + override fun deserialize(decoder: Decoder): List> { + return rawListSerializer.deserialize(decoder).map { + it.asMessage as ChatContentMessage<*> + } + } + } + + companion object { + internal val resultSerializer: DeserializationStrategy>> = MessagesDeserializer + } +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings.kt new file mode 100644 index 0000000000..c871fab100 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/managed_bots/GetManagedBotAccessSettings.kt @@ -0,0 +1,19 @@ +package dev.inmo.tgbotapi.requests.managed_bots + +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.ChatId +import dev.inmo.tgbotapi.types.managed_bots.BotAccessSettings +import dev.inmo.tgbotapi.types.userIdField +import kotlinx.serialization.* + +@Serializable +data class GetManagedBotAccessSettings( + @SerialName(userIdField) + val userId: ChatId +) : SimpleRequest { + override fun method(): String = "getManagedBotAccessSettings" + override val resultDeserializer: DeserializationStrategy + get() = BotAccessSettings.serializer() + override val requestSerializer: SerializationStrategy<*> + get() = serializer() +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings.kt new file mode 100644 index 0000000000..4b02d1f7ff --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/managed_bots/SetManagedBotAccessSettings.kt @@ -0,0 +1,26 @@ +package dev.inmo.tgbotapi.requests.managed_bots + +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.ChatId +import dev.inmo.tgbotapi.types.addedUserIdsField +import dev.inmo.tgbotapi.types.isAccessRestrictedField +import dev.inmo.tgbotapi.types.userIdField +import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer +import kotlinx.serialization.* + +@Serializable +data class SetManagedBotAccessSettings( + @SerialName(userIdField) + val userId: ChatId, + @SerialName(addedUserIdsField) + val addedUserIds: List? = null +) : SimpleRequest { + @EncodeDefault + @SerialName(isAccessRestrictedField) + val isAccessRestricted: Boolean = addedUserIds != null + override fun method(): String = "setManagedBotAccessSettings" + override val resultDeserializer: DeserializationStrategy + get() = UnitFromBooleanSerializer + override val requestSerializer: SerializationStrategy<*> + get() = serializer() +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index b104ccff20..9641af3309 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -62,7 +62,7 @@ val getUpdatesLimit = 1 .. 100 val callbackQueryAnswerLength = 0 until 200 val captionLength = 0 .. 1024 val storyCaptionLength = 0 .. 2048 -val textLength = 1 .. 4096 +val textLength = 0 .. 4096 val userProfilePhotosRequestLimit = 1 .. 100 val userProfileAudiosRequestLimit = 1 .. 100 val chatTitleLength = 1 until 255 @@ -241,6 +241,9 @@ const val maskPositionField = "mask_position" const val phoneNumberField = "phone_number" const val userIdField = "user_id" const val userIdsField = "user_ids" +const val isAccessRestrictedField = "is_access_restricted" +const val addedUsersField = "added_users" +const val addedUserIdsField = "added_user_ids" const val giftIdField = "gift_id" const val onlyIfBannedField = "only_if_banned" const val containsMasksField = "contains_masks" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/managed_bots/BotAccessSettings.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/managed_bots/BotAccessSettings.kt new file mode 100644 index 0000000000..93970f8533 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/managed_bots/BotAccessSettings.kt @@ -0,0 +1,18 @@ +package dev.inmo.tgbotapi.types.managed_bots + +import dev.inmo.tgbotapi.types.addedUsersField +import dev.inmo.tgbotapi.types.isAccessRestrictedField +import dev.inmo.tgbotapi.types.chat.User +import kotlinx.serialization.EncodeDefault +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class BotAccessSettings( + @SerialName(addedUsersField) + val addedUsers: List? = null +) { + @EncodeDefault + @SerialName(isAccessRestrictedField) + val isAccessRestricted: Boolean = addedUsers != null +}