mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-09-15 04:24:33 +00:00
feat(api)!: widen rich draft chat identifier
BREAKING CHANGE: SendRichMessageDraft, sendRichMessageDraft, and the rich-draft send overload now accept IdChatIdentifier. Existing ChatId source calls remain valid; JVM signatures changed.
This commit is contained in:
@@ -7070,19 +7070,19 @@ public final class dev/inmo/tgbotapi/requests/send/SendRichMessage$Companion {
|
||||
|
||||
public final class dev/inmo/tgbotapi/requests/send/SendRichMessageDraft : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest {
|
||||
public static final field Companion Ldev/inmo/tgbotapi/requests/send/SendRichMessageDraft$Companion;
|
||||
public synthetic fun <init> (JJLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Boolean;Ljava/lang/Boolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public synthetic fun <init> (JJLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun component1-tHkBKVM ()J
|
||||
public synthetic fun <init> (Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Boolean;Ljava/lang/Boolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public synthetic fun <init> (Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun component1 ()Ldev/inmo/tgbotapi/types/IdChatIdentifier;
|
||||
public final fun component2 ()J
|
||||
public final fun component3 ()Ldev/inmo/tgbotapi/types/rich/InputRichMessage;
|
||||
public final fun component4-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId;
|
||||
public final fun component5 ()Ljava/lang/Boolean;
|
||||
public final fun component6 ()Ljava/lang/Boolean;
|
||||
public final fun copy-Nl5m_rE (JJLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Boolean;Ljava/lang/Boolean;)Ldev/inmo/tgbotapi/requests/send/SendRichMessageDraft;
|
||||
public static synthetic fun copy-Nl5m_rE$default (Ldev/inmo/tgbotapi/requests/send/SendRichMessageDraft;JJLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendRichMessageDraft;
|
||||
public final fun copy-GAvqYPo (Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Boolean;Ljava/lang/Boolean;)Ldev/inmo/tgbotapi/requests/send/SendRichMessageDraft;
|
||||
public static synthetic fun copy-GAvqYPo$default (Ldev/inmo/tgbotapi/requests/send/SendRichMessageDraft;Ldev/inmo/tgbotapi/types/IdChatIdentifier;JLdev/inmo/tgbotapi/types/rich/InputRichMessage;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendRichMessageDraft;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getCanStop ()Ljava/lang/Boolean;
|
||||
public final fun getChatId-tHkBKVM ()J
|
||||
public final fun getChatId ()Ldev/inmo/tgbotapi/types/IdChatIdentifier;
|
||||
public final fun getDraftId ()J
|
||||
public final fun getKeepOnStop ()Ljava/lang/Boolean;
|
||||
public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.canStopField
|
||||
import dev.inmo.tgbotapi.types.chatIdField
|
||||
@@ -22,12 +22,13 @@ import kotlinx.serialization.SerializationStrategy
|
||||
* ephemeral and acts as a temporary 30-second preview - once the output is finalized, [SendRichMessage] must be called
|
||||
* with the complete message to persist it in the user's chat.
|
||||
*
|
||||
* @param chatId Numeric target chat identifier. Identifiers carrying a thread supply the default [threadId].
|
||||
* @see <a href="https://core.telegram.org/bots/api#sendrichmessagedraft">sendRichMessageDraft</a>
|
||||
*/
|
||||
@Serializable
|
||||
data class SendRichMessageDraft(
|
||||
@SerialName(chatIdField)
|
||||
val chatId: ChatId,
|
||||
val chatId: IdChatIdentifier,
|
||||
/**
|
||||
* Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated.
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,18 @@ class GeneralBotApi103Test {
|
||||
assertEquals("true", richDraftJson[keepOnStopField].toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `rich draft accepts thread-bearing chat identifiers`() {
|
||||
val chatId = ChatIdWithThreadId(RawChatId(3L), MessageThreadId(4L))
|
||||
val richDraft = SendRichMessageDraft(chatId, 5L, InputRichMessageHTML("draft"))
|
||||
val richDraftJson = json.encodeToJsonElement(SendRichMessageDraft.serializer(), richDraft).jsonObject
|
||||
|
||||
assertEquals(chatId, richDraft.chatId)
|
||||
assertEquals(MessageThreadId(4L), richDraft.threadId)
|
||||
assertEquals("3", richDraftJson[chatIdField].toString())
|
||||
assertEquals("4", richDraftJson[messageThreadIdField].toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `stopped message generation update deserializes`() {
|
||||
val update = nonstrictJsonFormat.decodeFromString(
|
||||
|
||||
Reference in New Issue
Block a user