From fd9ad8dbf1837e249c09c82ce5aa82aeea1b07c0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 16 Feb 2026 18:03:05 +0600 Subject: [PATCH] add drafts --- tgbotapi.api/api/tgbotapi.api.api | 35 +++++ .../extensions/api/send/SendMessageDraft.kt | 123 ++++++++++++++++ .../tgbotapi/extensions/api/send/Sends.kt | 132 ++++++++++++++++++ tgbotapi.core/api/tgbotapi.core.api | 79 ++++++----- .../requests/send/SendMessageDraft.kt | 103 +++----------- .../kotlin/dev/inmo/tgbotapi/types/Common.kt | 1 + .../kotlin/dev/inmo/tgbotapi/types/DraftId.kt | 18 +++ 7 files changed, 375 insertions(+), 116 deletions(-) create mode 100644 tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessageDraft.kt create mode 100644 tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/DraftId.kt diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index 9de8089116..7800939be1 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -1765,6 +1765,25 @@ public final class dev/inmo/tgbotapi/extensions/api/send/SendLiveLocationKt { public static synthetic fun sendLocation-xV04fPk$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ldev/inmo/tgbotapi/types/location/Location;ILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;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/SendMessageDraftKt { + public static final fun sendMessageDraft-85jglgs (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun sendMessageDraft-85jglgs (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendMessageDraft-85jglgs$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun sendMessageDraft-85jglgs$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendMessageDraft-OYtvHtc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLdev/inmo/tgbotapi/types/message/textsources/TextSource;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun sendMessageDraft-OYtvHtc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun sendMessageDraft-OYtvHtc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLdev/inmo/tgbotapi/types/message/textsources/TextSource;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun sendMessageDraft-OYtvHtc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendMessageDraft-OYtvHtc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLdev/inmo/tgbotapi/types/message/textsources/TextSource;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun sendMessageDraft-OYtvHtc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun sendMessageDraft-OYtvHtc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLdev/inmo/tgbotapi/types/message/textsources/TextSource;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun sendMessageDraft-OYtvHtc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendMessageDraft-PjdzSgQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun sendMessageDraft-PjdzSgQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendMessageDraft-PjdzSgQ$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun sendMessageDraft-PjdzSgQ$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; +} + public final class dev/inmo/tgbotapi/extensions/api/send/SendMessageKt { public static final fun sendMessage-EUozXF4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/message/textsources/TextSource;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/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun sendMessage-EUozXF4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;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/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -1843,6 +1862,10 @@ public final class dev/inmo/tgbotapi/extensions/api/send/SendsKt { public static final fun send-6LrTU6Q (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;ILjava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLdev/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 send-6LrTU6Q$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;ILjava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLdev/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 send-6LrTU6Q$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;ILjava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLdev/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 final fun send-85jglgs (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun send-85jglgs (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun send-85jglgs$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun send-85jglgs$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static final fun send-B42rpK4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZZLdev/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 send-B42rpK4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZZLdev/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 send-B42rpK4$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZZLdev/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; @@ -1897,6 +1920,18 @@ public final class dev/inmo/tgbotapi/extensions/api/send/SendsKt { public static final fun send-OEhgwS8 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;ILjava/util/List;Ljava/util/List;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLdev/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 send-OEhgwS8$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;ILjava/util/List;Ljava/util/List;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLdev/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 send-OEhgwS8$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;ILjava/util/List;Ljava/util/List;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLdev/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 final fun send-OYtvHtc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLdev/inmo/tgbotapi/types/message/textsources/TextSource;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun send-OYtvHtc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun send-OYtvHtc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLdev/inmo/tgbotapi/types/message/textsources/TextSource;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun send-OYtvHtc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun send-OYtvHtc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLdev/inmo/tgbotapi/types/message/textsources/TextSource;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun send-OYtvHtc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun send-OYtvHtc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLdev/inmo/tgbotapi/types/message/textsources/TextSource;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun send-OYtvHtc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun send-PjdzSgQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun send-PjdzSgQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun send-PjdzSgQ$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun send-PjdzSgQ$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static final fun send-Rhn938o (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;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 send-Rhn938o (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/util/List;ZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;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 send-Rhn938o (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;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; diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessageDraft.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessageDraft.kt new file mode 100644 index 0000000000..015ab5d879 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessageDraft.kt @@ -0,0 +1,123 @@ +package dev.inmo.tgbotapi.extensions.api.send + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.send.SendMessageDraft +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList +import dev.inmo.tgbotapi.types.message.ParseMode +import dev.inmo.tgbotapi.types.chat.Chat +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.content.TextContent +import dev.inmo.tgbotapi.types.message.textsources.TextSource +import dev.inmo.tgbotapi.utils.EntitiesBuilderBody +import dev.inmo.tgbotapi.utils.buildEntities + +public suspend fun TelegramBot.sendMessageDraft( + chatId: IdChatIdentifier, + draftId: DraftId, + text: String, + parseMode: ParseMode? = null, + threadId: MessageThreadId? = chatId.threadId +): Boolean = execute( + SendMessageDraft( + chatId = chatId, + draftId = draftId, + text = text, + parseMode = parseMode, + threadId = threadId + ) +) + +public suspend fun TelegramBot.sendMessageDraft( + chat: Chat, + draftId: DraftId, + text: String, + parseMode: ParseMode? = null, + threadId: MessageThreadId? = chat.id.threadId +): Boolean = sendMessageDraft( + chatId = chat.id as IdChatIdentifier, + draftId = draftId, + text = text, + parseMode = parseMode, + threadId = threadId +) + +public suspend fun TelegramBot.sendMessageDraft( + chatId: IdChatIdentifier, + draftId: DraftId, + entities: TextSourcesList, + threadId: MessageThreadId? = chatId.threadId +): Boolean = execute( + SendMessageDraft( + chatId = chatId, + draftId = draftId, + entities = entities, + threadId = threadId + ) +) + +public suspend fun TelegramBot.sendMessageDraft( + chat: Chat, + draftId: DraftId, + entities: TextSourcesList, + threadId: MessageThreadId? = chat.id.threadId +): Boolean = sendMessageDraft( + chatId = chat.id as IdChatIdentifier, + draftId = draftId, + entities = entities, + threadId = threadId +) + +public suspend fun TelegramBot.sendMessageDraft( + chatId: IdChatIdentifier, + draftId: DraftId, + separator: TextSource? = null, + threadId: MessageThreadId? = chatId.threadId, + builderBody: EntitiesBuilderBody +): Boolean = sendMessageDraft( + chatId = chatId, + draftId = draftId, + entities = buildEntities(separator, builderBody), + threadId = threadId +) + +public suspend fun TelegramBot.sendMessageDraft( + chatId: IdChatIdentifier, + draftId: DraftId, + separator: String, + threadId: MessageThreadId? = chatId.threadId, + builderBody: EntitiesBuilderBody +): Boolean = sendMessageDraft( + chatId = chatId, + draftId = draftId, + entities = buildEntities(separator, builderBody), + threadId = threadId +) + +public suspend fun TelegramBot.sendMessageDraft( + chat: Chat, + draftId: DraftId, + separator: TextSource? = null, + threadId: MessageThreadId? = chat.id.threadId, + builderBody: EntitiesBuilderBody +): Boolean = sendMessageDraft( + chatId = chat.id as IdChatIdentifier, + draftId = draftId, + separator = separator, + threadId = threadId, + builderBody = builderBody +) + +public suspend fun TelegramBot.sendMessageDraft( + chat: Chat, + draftId: DraftId, + separator: String, + threadId: MessageThreadId? = chat.id.threadId, + builderBody: EntitiesBuilderBody +): Boolean = sendMessageDraft( + chatId = chat.id as IdChatIdentifier, + draftId = draftId, + separator = separator, + threadId = threadId, + builderBody = builderBody +) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt index c0760ca6a5..af8a98ec52 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt @@ -1331,6 +1331,138 @@ public suspend fun TelegramBot.send( replyMarkup = replyMarkup ) +/** + * Will execute [sendMessageDraft] request + */ +public suspend fun TelegramBot.send( + chatId: IdChatIdentifier, + draftId: DraftId, + text: String, + parseMode: ParseMode? = null, + threadId: MessageThreadId? = chatId.threadId +): Boolean = sendMessageDraft( + chatId = chatId, + draftId = draftId, + text = text, + parseMode = parseMode, + threadId = threadId +) + +/** + * Will execute [sendMessageDraft] request + */ +public suspend fun TelegramBot.send( + chat: Chat, + draftId: DraftId, + text: String, + parseMode: ParseMode? = null, + threadId: MessageThreadId? = chat.id.threadId +): Boolean = sendMessageDraft( + chat = chat, + draftId = draftId, + text = text, + parseMode = parseMode, + threadId = threadId +) + +/** + * Will execute [sendMessageDraft] request + */ +public suspend fun TelegramBot.send( + chatId: IdChatIdentifier, + draftId: DraftId, + entities: TextSourcesList, + threadId: MessageThreadId? = chatId.threadId +): Boolean = sendMessageDraft( + chatId = chatId, + draftId = draftId, + entities = entities, + threadId = threadId +) + +/** + * Will execute [sendMessageDraft] request + */ +public suspend fun TelegramBot.send( + chat: Chat, + draftId: DraftId, + entities: TextSourcesList, + threadId: MessageThreadId? = chat.id.threadId +): Boolean = sendMessageDraft( + chat = chat, + draftId = draftId, + entities = entities, + threadId = threadId +) + +/** + * Will execute [sendMessageDraft] request + */ +public suspend fun TelegramBot.send( + chatId: IdChatIdentifier, + draftId: DraftId, + separator: TextSource? = null, + threadId: MessageThreadId? = chatId.threadId, + builderBody: EntitiesBuilderBody +): Boolean = sendMessageDraft( + chatId = chatId, + draftId = draftId, + separator = separator, + threadId = threadId, + builderBody = builderBody +) + +/** + * Will execute [sendMessageDraft] request + */ +public suspend fun TelegramBot.send( + chatId: IdChatIdentifier, + draftId: DraftId, + separator: String, + threadId: MessageThreadId? = chatId.threadId, + builderBody: EntitiesBuilderBody +): Boolean = sendMessageDraft( + chatId = chatId, + draftId = draftId, + separator = separator, + threadId = threadId, + builderBody = builderBody +) + +/** + * Will execute [sendMessageDraft] request + */ +public suspend fun TelegramBot.send( + chat: Chat, + draftId: DraftId, + separator: TextSource? = null, + threadId: MessageThreadId? = chat.id.threadId, + builderBody: EntitiesBuilderBody +): Boolean = sendMessageDraft( + chat = chat, + draftId = draftId, + separator = separator, + threadId = threadId, + builderBody = builderBody +) + +/** + * Will execute [sendMessageDraft] request + */ +public suspend fun TelegramBot.send( + chat: Chat, + draftId: DraftId, + separator: String, + threadId: MessageThreadId? = chat.id.threadId, + builderBody: EntitiesBuilderBody +): Boolean = sendMessageDraft( + chat = chat, + draftId = draftId, + separator = separator, + threadId = threadId, + builderBody = builderBody +) + /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * as a builder for that diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index cc50762110..6665adb154 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -6080,42 +6080,22 @@ public final class dev/inmo/tgbotapi/requests/send/SendLocationKt { public static synthetic fun SendStaticLocation-CbXiHO4$default (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;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Static; } -public final class dev/inmo/tgbotapi/requests/send/SendMessageDraft : dev/inmo/tgbotapi/abstracts/types/LinkPreviewOptionsContainer, dev/inmo/tgbotapi/requests/send/abstracts/ReplyingMarkupSendMessageRequest, dev/inmo/tgbotapi/requests/send/abstracts/SendContentMessageRequest, dev/inmo/tgbotapi/requests/send/abstracts/TextableSendMessageRequest { +public final class dev/inmo/tgbotapi/requests/send/SendMessageDraft : dev/inmo/tgbotapi/abstracts/TextedOutput, dev/inmo/tgbotapi/requests/send/abstracts/OptionallyMessageThreadRequest, dev/inmo/tgbotapi/requests/send/abstracts/SendChatMessageRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/send/SendMessageDraft$Companion; - public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;Ldev/inmo/tgbotapi/types/LinkPreviewOptions;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 - public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; - public final fun component10 ()Z - public final fun component11 ()Z - public final fun component12-Ts0V7ak ()Ljava/lang/String; - public final fun component13 ()Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters; - public final fun component14 ()Ldev/inmo/tgbotapi/types/ReplyParameters; - public final fun component15 ()Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Ldev/inmo/tgbotapi/types/message/ParseMode; - public final fun component5-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; - public final fun component6-1osv_qQ ()Ldev/inmo/tgbotapi/types/DirectMessageThreadId; - public final fun component7-nXr5wdE ()Ljava/lang/String; - public final fun component8 ()Ldev/inmo/tgbotapi/types/LinkPreviewOptions; - public final fun component9 ()Z + public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ldev/inmo/tgbotapi/types/IdChatIdentifier; + public final fun component2-12UPeIw ()J + public final fun component3 ()Ljava/lang/String; + public final fun component4 ()Ldev/inmo/tgbotapi/types/message/ParseMode; + public final fun component6-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; public fun equals (Ljava/lang/Object;)Z - public fun getAllowPaidBroadcast ()Z - public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; - public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; - public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; - public fun getDirectMessageThreadId-1osv_qQ ()Ldev/inmo/tgbotapi/types/DirectMessageThreadId; - public fun getDisableNotification ()Z - public fun getDisableWebPagePreview ()Ljava/lang/Boolean; - public fun getEffectId-Ts0V7ak ()Ljava/lang/String; + public synthetic fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; + public fun getChatId ()Ldev/inmo/tgbotapi/types/IdChatIdentifier; + public final fun getDraftId-12UPeIw ()J public fun getEntities ()Ljava/util/List; - public fun getLinkPreviewOptions ()Ldev/inmo/tgbotapi/types/LinkPreviewOptions; public fun getParseMode ()Ldev/inmo/tgbotapi/types/message/ParseMode; - public fun getProtectContent ()Z - public fun getReplyMarkup ()Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup; - public fun getReplyParameters ()Ldev/inmo/tgbotapi/types/ReplyParameters; - public fun getReplyToMessageId-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; - public fun getSuggestedPostParameters ()Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters; public fun getText ()Ljava/lang/String; public fun getTextSources ()Ljava/util/List; public fun getThreadId-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; @@ -6140,10 +6120,10 @@ public final class dev/inmo/tgbotapi/requests/send/SendMessageDraft$Companion { } public final class dev/inmo/tgbotapi/requests/send/SendMessageDraftKt { - public static final fun SendMessageDraft-8a9pvUw (Ldev/inmo/tgbotapi/types/ChatIdentifier;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;)Ldev/inmo/tgbotapi/requests/send/SendMessageDraft; - public static synthetic fun SendMessageDraft-8a9pvUw$default (Ldev/inmo/tgbotapi/types/ChatIdentifier;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;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendMessageDraft; - public static final fun SendMessageDraft-CbXiHO4 (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;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;)Ldev/inmo/tgbotapi/requests/send/SendMessageDraft; - public static synthetic fun SendMessageDraft-CbXiHO4$default (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;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;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendMessageDraft; + public static final fun SendMessageDraft-r0NzpGw (Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;)Ldev/inmo/tgbotapi/requests/send/SendMessageDraft; + public static synthetic fun SendMessageDraft-r0NzpGw$default (Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ldev/inmo/tgbotapi/types/MessageThreadId;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendMessageDraft; + public static final fun SendMessageDraft-u22-530 (Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;)Ldev/inmo/tgbotapi/requests/send/SendMessageDraft; + public static synthetic fun SendMessageDraft-u22-530$default (Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLjava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendMessageDraft; } public final class dev/inmo/tgbotapi/requests/send/SendMessageKt { @@ -10397,6 +10377,7 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final field documentField Ljava/lang/String; public static final field documentFileIdField Ljava/lang/String; public static final field documentUrlField Ljava/lang/String; + public static final field draftIdField Ljava/lang/String; public static final field driverLicenseField Ljava/lang/String; public static final field dropPendingUpdatesField Ljava/lang/String; public static final field durationField Ljava/lang/String; @@ -11069,6 +11050,36 @@ public final class dev/inmo/tgbotapi/types/DirectMessagesConfigurationChanged$Pa public final fun serializer ()Lkotlinx/serialization/KSerializer; } +public final class dev/inmo/tgbotapi/types/DraftId { + public static final field Companion Ldev/inmo/tgbotapi/types/DraftId$Companion; + public static final synthetic fun box-impl (J)Ldev/inmo/tgbotapi/types/DraftId; + public static fun constructor-impl (J)J + public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (JLjava/lang/Object;)Z + public static final fun equals-impl0 (JJ)Z + public final fun getLong ()J + public fun hashCode ()I + public static fun hashCode-impl (J)I + public fun toString ()Ljava/lang/String; + public static fun toString-impl (J)Ljava/lang/String; + public final synthetic fun unbox-impl ()J +} + +public final synthetic class dev/inmo/tgbotapi/types/DraftId$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/DraftId$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public final fun deserialize-2sDQ-Rg (Lkotlinx/serialization/encoding/Decoder;)J + public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public final fun serialize-hUXZVL4 (Lkotlinx/serialization/encoding/Encoder;J)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/types/DraftId$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/inmo/tgbotapi/types/EffectId { public static final field Companion Ldev/inmo/tgbotapi/types/EffectId$Companion; public static final synthetic fun box-impl (Ljava/lang/String;)Ldev/inmo/tgbotapi/types/EffectId; diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessageDraft.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessageDraft.kt index 0fd2832d65..fca355c99f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessageDraft.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessageDraft.kt @@ -1,13 +1,11 @@ package dev.inmo.tgbotapi.requests.send -import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer +import dev.inmo.tgbotapi.abstracts.TextedOutput import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField -import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.* import dev.inmo.tgbotapi.types.message.RawMessageEntity import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage @@ -17,80 +15,44 @@ import dev.inmo.tgbotapi.types.message.toRawMessageEntities import dev.inmo.tgbotapi.utils.extensions.makeString import dev.inmo.tgbotapi.utils.throwRangeError import kotlinx.serialization.* - -internal val TextContentMessageDraftResultDeserializer: DeserializationStrategy> - = TelegramBotAPIMessageDeserializationStrategyClass() +import kotlinx.serialization.builtins.serializer fun SendMessageDraft( - chatId: ChatIdentifier, + chatId: IdChatIdentifier, + draftId: DraftId, text: String, parseMode: ParseMode? = null, - linkPreviewOptions: LinkPreviewOptions? = null, - 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 + threadId: MessageThreadId? = chatId.threadId ) = SendMessageDraft( chatId = chatId, + draftId = draftId, text = text, parseMode = parseMode, rawEntities = null, - threadId = threadId, - directMessageThreadId = directMessageThreadId, - businessConnectionId = businessConnectionId, - linkPreviewOptions = linkPreviewOptions, - disableNotification = disableNotification, - protectContent = protectContent, - allowPaidBroadcast = allowPaidBroadcast, - effectId = effectId, - suggestedPostParameters = suggestedPostParameters, - replyParameters = replyParameters, - replyMarkup = replyMarkup + threadId = threadId ) fun SendMessageDraft( - chatId: ChatIdentifier, + chatId: IdChatIdentifier, + draftId: DraftId, entities: TextSourcesList, - linkPreviewOptions: LinkPreviewOptions? = null, - 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 + threadId: MessageThreadId? = chatId.threadId ) = SendMessageDraft( chatId = chatId, + draftId = draftId, text = entities.makeString(), parseMode = null, rawEntities = entities.toRawMessageEntities(), - threadId = threadId, - directMessageThreadId = directMessageThreadId, - businessConnectionId = businessConnectionId, - linkPreviewOptions = linkPreviewOptions, - disableNotification = disableNotification, - protectContent = protectContent, - allowPaidBroadcast = allowPaidBroadcast, - effectId = effectId, - suggestedPostParameters = suggestedPostParameters, - replyParameters = replyParameters, - replyMarkup = replyMarkup + threadId = threadId ) @ConsistentCopyVisibility @Serializable data class SendMessageDraft internal constructor( @SerialName(chatIdField) - override val chatId: ChatIdentifier, + override val chatId: IdChatIdentifier, + @SerialName(draftIdField) + val draftId: DraftId, @SerialName(textField) override val text: String, @SerialName(parseModeField) @@ -100,33 +62,10 @@ data class SendMessageDraft internal constructor( @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(linkPreviewOptionsField) - override val linkPreviewOptions: LinkPreviewOptions? = null, - @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>, - ReplyingMarkupSendMessageRequest>, - TextableSendMessageRequest>, - LinkPreviewOptionsContainer + override val threadId: MessageThreadId? = chatId.threadId +) : SendChatMessageRequest, + TextedOutput, + OptionallyMessageThreadRequest { override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text) @@ -139,8 +78,8 @@ data class SendMessageDraft internal constructor( } override fun method(): String = "sendMessageDraft" - override val resultDeserializer: DeserializationStrategy> - get() = TextContentMessageDraftResultDeserializer + override val resultDeserializer: DeserializationStrategy + get() = Boolean.serializer() 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 0cf8f047ba..831a12e6b8 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 @@ -533,6 +533,7 @@ const val subscriptionPeriodField = "subscription_period" const val subscriptionPriceField = "subscription_price" const val copyTextField = "copy_text" const val topicIdField = "topic_id" +const val draftIdField = "draft_id" const val isPublicField = "is_public" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/DraftId.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/DraftId.kt new file mode 100644 index 0000000000..01d0f853c0 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/DraftId.kt @@ -0,0 +1,18 @@ +package dev.inmo.tgbotapi.types + +import dev.inmo.kslog.common.w +import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog +import kotlinx.serialization.Serializable +import kotlin.jvm.JvmInline + +@Serializable +@JvmInline +value class DraftId( + val long: Long +) { + init { + if (long == 0L) { + DefaultKTgBotAPIKSLog.w("DraftId", "In DraftId has been passed 0. According to the documentation it must not be 0") + } + } +}