From 048f65b8d42a38c497c84bf6350b87ad9aee5f09 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 25 Aug 2025 16:39:23 +0600 Subject: [PATCH] Partially add DirectMessagesTopic --- tgbotapi.core/api/tgbotapi.core.api | 105 ++++++++++++------ .../kotlin/dev/inmo/tgbotapi/types/Common.kt | 1 + .../types/chat/DirectMessagesTopic.kt | 17 +++ .../suggested/SuggestedPostApprovalFailed.kt | 1 + .../suggested/SuggestedPostApproved.kt | 1 + .../suggested/SuggestedPostDeclined.kt | 1 + .../ChatEvents/suggested/SuggestedPostPaid.kt | 5 + .../suggested/SuggestedPostRefunded.kt | 1 + .../tgbotapi/types/message/GroupMessages.kt | 6 + .../inmo/tgbotapi/types/message/RawMessage.kt | 4 + .../types/message/abstracts/GroupMessages.kt | 1 + .../MediaGroupContentMessageCreator.kt | 2 + tgbotapi.utils/api/tgbotapi.utils.api | 3 + .../extensions/utils/ClassCastsNew.kt | 7 ++ 14 files changed, 121 insertions(+), 34 deletions(-) create mode 100644 tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/DirectMessagesTopic.kt diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 4762751292..ea8801bcb9 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -10416,6 +10416,7 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final field titleEntitiesField Ljava/lang/String; public static final field titleField Ljava/lang/String; public static final field topColorField Ljava/lang/String; + public static final field topicIdField Ljava/lang/String; public static final field totalAmountField Ljava/lang/String; public static final field totalCountField Ljava/lang/String; public static final field totalVoterCountField Ljava/lang/String; @@ -16548,6 +16549,37 @@ public final class dev/inmo/tgbotapi/types/chat/CommonUser$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } +public final class dev/inmo/tgbotapi/types/chat/DirectMessagesTopic : dev/inmo/tgbotapi/abstracts/OptionallyWithUser { + public static final field Companion Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic$Companion; + public synthetic fun (JLdev/inmo/tgbotapi/types/chat/PreviewUser;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLdev/inmo/tgbotapi/types/chat/PreviewUser;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-hDmiKeI ()J + public final fun component2 ()Ldev/inmo/tgbotapi/types/chat/PreviewUser; + public final fun copy-sqYNc9k (JLdev/inmo/tgbotapi/types/chat/PreviewUser;)Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; + public static synthetic fun copy-sqYNc9k$default (Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic;JLdev/inmo/tgbotapi/types/chat/PreviewUser;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; + public fun equals (Ljava/lang/Object;)Z + public final fun getThreadId-hDmiKeI ()J + public fun getUser ()Ldev/inmo/tgbotapi/types/chat/PreviewUser; + public synthetic fun getUser ()Ldev/inmo/tgbotapi/types/chat/User; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final synthetic class dev/inmo/tgbotapi/types/chat/DirectMessagesTopic$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; + 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/chat/DirectMessagesTopic;)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/chat/DirectMessagesTopic$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/inmo/tgbotapi/types/chat/ExtendedBot : dev/inmo/tgbotapi/types/chat/Bot, dev/inmo/tgbotapi/types/chat/ExtendedChat { public static final field Companion Ldev/inmo/tgbotapi/types/chat/ExtendedBot$Companion; public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;IZLdev/inmo/tgbotapi/types/gifts/AcceptedGiftTypes;ILkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -22802,28 +22834,29 @@ public final class dev/inmo/tgbotapi/types/message/ChatEvents/voice/VideoChatSta } public final class dev/inmo/tgbotapi/types/message/CommonChannelDirectMessagesContentMessageImpl : dev/inmo/tgbotapi/types/message/abstracts/CommonChannelDirectMessagesContentMessage { - public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/message/ForwardInfo;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/message/ForwardInfo;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/ForwardInfo;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/ForwardInfo;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat; - public final fun component10 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun component11 ()Ldev/inmo/tgbotapi/types/message/content/MessageContent; - public final fun component12 ()Ldev/inmo/tgbotapi/types/chat/CommonBot; - public final fun component13-CsYhHCU ()Ljava/lang/String; - public final fun component14 ()Ljava/lang/Integer; - public final fun component15 ()Z - public final fun component16 ()Ljava/lang/Integer; + public final fun component10 ()Ldev/inmo/tgbotapi/types/ReplyInfo; + public final fun component11 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; + public final fun component12 ()Ldev/inmo/tgbotapi/types/message/content/MessageContent; + public final fun component13 ()Ldev/inmo/tgbotapi/types/chat/CommonBot; + public final fun component14-CsYhHCU ()Ljava/lang/String; + public final fun component15 ()Ljava/lang/Integer; + public final fun component16 ()Z + public final fun component17 ()Ljava/lang/Integer; public final fun component2-APLFQys ()J public final fun component3-hDmiKeI ()J public final fun component4 ()Ldev/inmo/tgbotapi/types/chat/User; public final fun component5-Wg0KzQs ()D - public final fun component6 ()Ldev/inmo/tgbotapi/types/message/MessageOrigin; - public final fun component7-Ivn3T5g ()Lkorlibs/time/DateTime; - public final fun component8 ()Z - public final fun component9 ()Ldev/inmo/tgbotapi/types/ReplyInfo; - public final fun copy-_c83v58 (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;)Ldev/inmo/tgbotapi/types/message/CommonChannelDirectMessagesContentMessageImpl; - public static synthetic fun copy-_c83v58$default (Ldev/inmo/tgbotapi/types/message/CommonChannelDirectMessagesContentMessageImpl;Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/message/CommonChannelDirectMessagesContentMessageImpl; + public final fun component6 ()Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; + public final fun component7 ()Ldev/inmo/tgbotapi/types/message/MessageOrigin; + public final fun component8-Ivn3T5g ()Lkorlibs/time/DateTime; + public final fun component9 ()Z + public final fun copy-I4QeWRE (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;)Ldev/inmo/tgbotapi/types/message/CommonChannelDirectMessagesContentMessageImpl; + public static synthetic fun copy-I4QeWRE$default (Ldev/inmo/tgbotapi/types/message/CommonChannelDirectMessagesContentMessageImpl;Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;JJLdev/inmo/tgbotapi/types/chat/User;DLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/Integer;ZLjava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/message/CommonChannelDirectMessagesContentMessageImpl; public fun equals (Ljava/lang/Object;)Z public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; public fun getChat ()Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat; @@ -22834,6 +22867,7 @@ public final class dev/inmo/tgbotapi/types/message/CommonChannelDirectMessagesCo public fun getContent ()Ldev/inmo/tgbotapi/types/message/content/MessageContent; public fun getCost ()Ljava/lang/Integer; public fun getDate-Wg0KzQs ()D + public fun getDirectMessageTopic ()Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; public fun getEditDate-Ivn3T5g ()Lkorlibs/time/DateTime; public fun getForwardInfo ()Ldev/inmo/tgbotapi/types/message/ForwardInfo; public fun getForwardOrigin ()Ldev/inmo/tgbotapi/types/message/MessageOrigin; @@ -23178,28 +23212,29 @@ public final class dev/inmo/tgbotapi/types/message/ForwardInfoKt { } public final class dev/inmo/tgbotapi/types/message/FromChannelChannelDirectMessagesContentMessageImpl : dev/inmo/tgbotapi/types/message/abstracts/FromChannelChannelDirectMessagesContentMessage { - public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/message/ForwardInfo;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/message/ForwardInfo;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/ForwardInfo;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/ForwardInfo;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat; - public final fun component10 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun component11 ()Ldev/inmo/tgbotapi/types/message/content/MessageContent; - public final fun component12 ()Ldev/inmo/tgbotapi/types/chat/CommonBot; - public final fun component13 ()Ljava/lang/String; - public final fun component14-CsYhHCU ()Ljava/lang/String; - public final fun component15 ()Z - public final fun component16 ()Ljava/lang/Integer; + public final fun component10 ()Ldev/inmo/tgbotapi/types/ReplyInfo; + public final fun component11 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; + public final fun component12 ()Ldev/inmo/tgbotapi/types/message/content/MessageContent; + public final fun component13 ()Ldev/inmo/tgbotapi/types/chat/CommonBot; + public final fun component14 ()Ljava/lang/String; + public final fun component15-CsYhHCU ()Ljava/lang/String; + public final fun component16 ()Z + public final fun component17 ()Ljava/lang/Integer; public final fun component2 ()Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat; public final fun component3-APLFQys ()J public final fun component4-hDmiKeI ()J public final fun component5-Wg0KzQs ()D - public final fun component6 ()Ldev/inmo/tgbotapi/types/message/MessageOrigin; - public final fun component7-Ivn3T5g ()Lkorlibs/time/DateTime; - public final fun component8 ()Z - public final fun component9 ()Ldev/inmo/tgbotapi/types/ReplyInfo; - public final fun copy-T1kMFck (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;)Ldev/inmo/tgbotapi/types/message/FromChannelChannelDirectMessagesContentMessageImpl; - public static synthetic fun copy-T1kMFck$default (Ldev/inmo/tgbotapi/types/message/FromChannelChannelDirectMessagesContentMessageImpl;Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/message/FromChannelChannelDirectMessagesContentMessageImpl; + public final fun component6 ()Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; + public final fun component7 ()Ldev/inmo/tgbotapi/types/message/MessageOrigin; + public final fun component8-Ivn3T5g ()Lkorlibs/time/DateTime; + public final fun component9 ()Z + public final fun copy-q-JDLes (Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;)Ldev/inmo/tgbotapi/types/message/FromChannelChannelDirectMessagesContentMessageImpl; + public static synthetic fun copy-q-JDLes$default (Ldev/inmo/tgbotapi/types/message/FromChannelChannelDirectMessagesContentMessageImpl;Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat;Ldev/inmo/tgbotapi/types/chat/PreviewChannelChat;JJDLdev/inmo/tgbotapi/types/chat/DirectMessagesTopic;Ldev/inmo/tgbotapi/types/message/MessageOrigin;Lkorlibs/time/DateTime;ZLdev/inmo/tgbotapi/types/ReplyInfo;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/message/content/MessageContent;Ldev/inmo/tgbotapi/types/chat/CommonBot;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/message/FromChannelChannelDirectMessagesContentMessageImpl; public fun equals (Ljava/lang/Object;)Z public fun getAuthorSignature ()Ljava/lang/String; public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; @@ -23212,6 +23247,7 @@ public final class dev/inmo/tgbotapi/types/message/FromChannelChannelDirectMessa public fun getContent ()Ldev/inmo/tgbotapi/types/message/content/MessageContent; public fun getCost ()Ljava/lang/Integer; public fun getDate-Wg0KzQs ()D + public fun getDirectMessageTopic ()Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; public fun getEditDate-Ivn3T5g ()Lkorlibs/time/DateTime; public fun getForwardInfo ()Ldev/inmo/tgbotapi/types/message/ForwardInfo; public fun getForwardOrigin ()Ldev/inmo/tgbotapi/types/message/MessageOrigin; @@ -23812,6 +23848,7 @@ public final class dev/inmo/tgbotapi/types/message/abstracts/ChannelContentMessa public abstract interface class dev/inmo/tgbotapi/types/message/abstracts/ChannelDirectMessagesContentMessage : dev/inmo/tgbotapi/types/message/abstracts/ForumContentMessage, dev/inmo/tgbotapi/types/message/abstracts/PossiblyTopicMessage { public abstract fun getChat ()Ldev/inmo/tgbotapi/types/chat/PreviewChannelDirectMessagesChat; + public abstract fun getDirectMessageTopic ()Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; } public final class dev/inmo/tgbotapi/types/message/abstracts/ChannelDirectMessagesContentMessage$DefaultImpls { 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 b254ebc12e..ec9e23ce42 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 @@ -524,6 +524,7 @@ const val creatorField = "creator" const val subscriptionPeriodField = "subscription_period" const val subscriptionPriceField = "subscription_price" const val copyTextField = "copy_text" +const val topicIdField = "topic_id" const val isPublicField = "is_public" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/DirectMessagesTopic.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/DirectMessagesTopic.kt new file mode 100644 index 0000000000..0854474457 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/DirectMessagesTopic.kt @@ -0,0 +1,17 @@ +package dev.inmo.tgbotapi.types.chat + +import dev.inmo.tgbotapi.abstracts.OptionallyWithUser +import dev.inmo.tgbotapi.types.MessageThreadId +import dev.inmo.tgbotapi.types.topicIdField +import dev.inmo.tgbotapi.types.userField +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class DirectMessagesTopic( + @SerialName(topicIdField) + val threadId: MessageThreadId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @SerialName(userField) + override val user: PreviewUser? = null, +) : OptionallyWithUser diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostApprovalFailed.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostApprovalFailed.kt index cd2a4228ef..b73891f745 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostApprovalFailed.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostApprovalFailed.kt @@ -13,6 +13,7 @@ import kotlinx.serialization.Serializable data class SuggestedPostApprovalFailed( @SerialName(priceField) // TODO::Test that this field will never be null val price: SuggestedPostPrice, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(suggestedPostMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) val suggestedPostMessage: ChannelDirectMessagesContentMessage<*>? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostApproved.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostApproved.kt index 4147b8f2f1..dbe5ac75b7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostApproved.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostApproved.kt @@ -15,6 +15,7 @@ import kotlinx.serialization.Serializable data class SuggestedPostApproved( @SerialName(sendDateField) val sendDate: TelegramDate, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(suggestedPostMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) val suggestedPostMessage: ChannelDirectMessagesContentMessage<*>? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostDeclined.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostDeclined.kt index 933338ba46..7fdeeb5aa3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostDeclined.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostDeclined.kt @@ -10,6 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class SuggestedPostDeclined( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(suggestedPostMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) val suggestedPostMessage: ChannelDirectMessagesContentMessage<*>? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostPaid.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostPaid.kt index 160ae07108..e7f554464e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostPaid.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostPaid.kt @@ -30,12 +30,14 @@ sealed interface SuggestedPostPaid : Currencied, ChannelDirectMessagesEvent { data class XTR( @SerialName(starAmountField) override val starAmount: StarAmount, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(suggestedPostMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) override val suggestedPostMessage: ChannelDirectMessagesContentMessage<*>? = null, ) : SuggestedPostPaid { override val amount: Long? get() = null + @Suppress("OPT_IN_USAGE") @EncodeDefault override val currency: Currency = Currency.XTR } @@ -43,12 +45,14 @@ sealed interface SuggestedPostPaid : Currencied, ChannelDirectMessagesEvent { data class TON( @SerialName(amountField) override val amount: Long, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(suggestedPostMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) override val suggestedPostMessage: ChannelDirectMessagesContentMessage<*>? = null ) : SuggestedPostPaid { override val starAmount: StarAmount? get() = null + @Suppress("OPT_IN_USAGE") @EncodeDefault override val currency: Currency = Currency.TON } @@ -56,6 +60,7 @@ sealed interface SuggestedPostPaid : Currencied, ChannelDirectMessagesEvent { data class Other( @SerialName(currencyField) override val currency: Currency, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(suggestedPostMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) override val suggestedPostMessage: ChannelDirectMessagesContentMessage<*>? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostRefunded.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostRefunded.kt index 14bff8f0a2..189621298b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostRefunded.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/suggested/SuggestedPostRefunded.kt @@ -12,6 +12,7 @@ import kotlinx.serialization.Serializable data class SuggestedPostRefunded( @SerialName(reasonField) val reason: String, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(suggestedPostMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) val suggestedPostMessage: ChannelDirectMessagesContentMessage<*>? = null diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/GroupMessages.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/GroupMessages.kt index 3d55fc7828..5dcfcc0d46 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/GroupMessages.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/GroupMessages.kt @@ -282,6 +282,7 @@ data class FromChannelChannelDirectMessagesContentMessageImpl override val messageId: MessageId, override val threadId: MessageThreadId, override val date: DateTime, + override val directMessageTopic: DirectMessagesTopic, override val forwardOrigin: MessageOrigin?, override val editDate: DateTime?, override val hasProtectedContent: Boolean, @@ -301,6 +302,7 @@ data class FromChannelChannelDirectMessagesContentMessageImpl messageId: MessageId, threadId: MessageThreadId, date: DateTime, + directMessageTopic: DirectMessagesTopic, forwardInfo: ForwardInfo, editDate: DateTime?, hasProtectedContent: Boolean, @@ -318,6 +320,7 @@ data class FromChannelChannelDirectMessagesContentMessageImpl messageId = messageId, threadId = threadId, date = date, + directMessageTopic = directMessageTopic, forwardOrigin = forwardInfo.messageOrigin(), editDate = editDate, hasProtectedContent = hasProtectedContent, @@ -448,6 +451,7 @@ data class CommonChannelDirectMessagesContentMessageImpl( override val threadId: MessageThreadId, override val from: User, override val date: DateTime, + override val directMessageTopic: DirectMessagesTopic, override val forwardOrigin: MessageOrigin?, override val editDate: DateTime?, override val hasProtectedContent: Boolean, @@ -467,6 +471,7 @@ data class CommonChannelDirectMessagesContentMessageImpl( threadId: MessageThreadId, from: User, date: DateTime, + directMessageTopic: DirectMessagesTopic, forwardInfo: ForwardInfo, editDate: DateTime?, hasProtectedContent: Boolean, @@ -484,6 +489,7 @@ data class CommonChannelDirectMessagesContentMessageImpl( threadId = threadId, from = from, date = date, + directMessageTopic = directMessageTopic, forwardOrigin = forwardInfo.messageOrigin(), editDate = editDate, hasProtectedContent = hasProtectedContent, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt index 77bc10f52f..2ef230df31 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt @@ -62,6 +62,7 @@ internal data class RawMessage( private val chat: PreviewChat, @SerialName(messageThreadIdField) private val messageThreadId: MessageThreadId? = null, + private val direct_messages_topic: DirectMessagesTopic? = null, @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") private val from: PreviewUser? = null, @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @@ -417,6 +418,7 @@ internal data class RawMessage( ) is PreviewForumChat -> when(chat) { is PreviewChannelDirectMessagesChat -> { + val messageThreadId = direct_messages_topic ?.threadId ?: messageThreadId if (messageThreadId != null) { val chatId = ChatIdWithThreadId( chat.id.chatId, @@ -432,6 +434,7 @@ internal data class RawMessage( messageId = messageId, threadId = messageThreadId, date = date.asDate, + directMessageTopic = direct_messages_topic ?: error("direct_messages_topic must be presented for FromChannelChannelDirectMessagesContentMessage"), forwardOrigin = forward_origin, editDate = edit_date ?.asDate, hasProtectedContent = has_protected_content == true, @@ -451,6 +454,7 @@ internal data class RawMessage( threadId = messageThreadId, 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 ?: error("direct_messages_topic must be presented for CommonChannelDirectMessagesContentMessage"), forwardOrigin = forward_origin, editDate = edit_date ?.asDate, hasProtectedContent = has_protected_content == true, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/GroupMessages.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/GroupMessages.kt index 832b9b4558..3e917810c4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/GroupMessages.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/GroupMessages.kt @@ -24,6 +24,7 @@ sealed interface ForumContentMessage : GroupContentMessage : ForumContentMessage, PossiblyTopicMessage { override val chat: PreviewChannelDirectMessagesChat + val directMessageTopic: DirectMessagesTopic } sealed interface FromChannelGroupContentMessage : GroupContentMessage, SignedMessage, WithSenderChatMessage { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/MediaGroupContentMessageCreator.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/MediaGroupContentMessageCreator.kt index 3382efc7ce..6d35213263 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/MediaGroupContentMessageCreator.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/MediaGroupContentMessageCreator.kt @@ -175,6 +175,7 @@ fun List>.asMedia threadId = sourceMessage.threadId, from = sourceMessage.user, date = sourceMessage.date, + directMessageTopic = sourceMessage.directMessageTopic, forwardOrigin = sourceMessage.forwardOrigin, editDate = sourceMessage.editDate, hasProtectedContent = sourceMessage.hasProtectedContent, @@ -212,6 +213,7 @@ fun List>.asMedia messageId = sourceMessage.messageId, threadId = sourceMessage.threadId, date = sourceMessage.date, + directMessageTopic = sourceMessage.directMessageTopic, forwardOrigin = sourceMessage.forwardOrigin, editDate = sourceMessage.editDate, hasProtectedContent = sourceMessage.hasProtectedContent, diff --git a/tgbotapi.utils/api/tgbotapi.utils.api b/tgbotapi.utils/api/tgbotapi.utils.api index 2dbafce8b8..f7ed3f88b8 100644 --- a/tgbotapi.utils/api/tgbotapi.utils.api +++ b/tgbotapi.utils/api/tgbotapi.utils.api @@ -1335,6 +1335,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt { public static final fun diceContentOrThrow (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/DiceContent; public static final fun dimmableOrNull (Ldev/inmo/tgbotapi/types/BackgroundType;)Ldev/inmo/tgbotapi/types/BackgroundType$Dimmable; public static final fun dimmableOrThrow (Ldev/inmo/tgbotapi/types/BackgroundType;)Ldev/inmo/tgbotapi/types/BackgroundType$Dimmable; + public static final fun directMessagesTopicOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; + public static final fun directMessagesTopicOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/DirectMessagesTopic; public static final fun disabledOrNull (Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection;)Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection$Disabled; public static final fun disabledOrThrow (Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection;)Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection$Disabled; public static final fun documentContentOrNull (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/DocumentContent; @@ -1686,6 +1688,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt { public static final fun ifDescribedInlineQueryResult (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ifDiceContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ifDimmable (Ldev/inmo/tgbotapi/types/BackgroundType;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ifDirectMessagesTopic (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ifDisabled (Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ifDocumentContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ifDocumentFile (Ldev/inmo/tgbotapi/types/files/TelegramMediaFile;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt index 5ffa6803e4..344b748b70 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt @@ -130,6 +130,7 @@ import dev.inmo.tgbotapi.types.chat.ChatJoinRequest import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated import dev.inmo.tgbotapi.types.chat.CommonBot import dev.inmo.tgbotapi.types.chat.CommonUser +import dev.inmo.tgbotapi.types.chat.DirectMessagesTopic import dev.inmo.tgbotapi.types.chat.ExtendedBot import dev.inmo.tgbotapi.types.chat.ExtendedBusinessChat import dev.inmo.tgbotapi.types.chat.ExtendedChannelChat @@ -641,6 +642,12 @@ public inline fun OptionallyWithUser.chatJoinRequestOrThrow(): ChatJoinRequest = public inline fun OptionallyWithUser.ifChatJoinRequest(block: (ChatJoinRequest) -> T): T? = chatJoinRequestOrNull() ?.let(block) +public inline fun OptionallyWithUser.directMessagesTopicOrNull(): DirectMessagesTopic? = this as? dev.inmo.tgbotapi.types.chat.DirectMessagesTopic + +public inline fun OptionallyWithUser.directMessagesTopicOrThrow(): DirectMessagesTopic = this as dev.inmo.tgbotapi.types.chat.DirectMessagesTopic + +public inline fun OptionallyWithUser.ifDirectMessagesTopic(block: (DirectMessagesTopic) -> T): T? = directMessagesTopicOrNull() ?.let(block) + public inline fun OptionallyWithUser.administratorChatMemberOrNull(): AdministratorChatMember? = this as? dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember public inline fun OptionallyWithUser.administratorChatMemberOrThrow(): AdministratorChatMember = this as dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember