1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

add flag sentByBusinessConnectionOwner

This commit is contained in:
InsanusMokrassar 2024-04-18 20:07:33 +06:00
parent eff2f2ba41
commit 0a9235bcd9
4 changed files with 27 additions and 14 deletions

View File

@ -7301,9 +7301,9 @@ public final class dev/inmo/tgbotapi/types/BusinessChatId : dev/inmo/tgbotapi/ty
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (Lkotlin/Pair;Ljava/lang/Object;)Z
public static final fun equals-impl0 (Lkotlin/Pair;Lkotlin/Pair;)Z
public fun getBusinessId-T-_HSQI ()Ljava/lang/String;
public static fun getBusinessId-T-_HSQI (Lkotlin/Pair;)Ljava/lang/String;
public synthetic fun getBusinessId-nXr5wdE ()Ljava/lang/String;
public fun getBusinessConnectionId-T-_HSQI ()Ljava/lang/String;
public static fun getBusinessConnectionId-T-_HSQI (Lkotlin/Pair;)Ljava/lang/String;
public synthetic fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String;
public fun getChatId-iyD94Bc ()J
public static fun getChatId-iyD94Bc (Lkotlin/Pair;)J
public final fun getChatIdWithBusinessConnectionId ()Lkotlin/Pair;
@ -7357,8 +7357,8 @@ public final class dev/inmo/tgbotapi/types/ChatId : dev/inmo/tgbotapi/types/IdCh
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 fun getBusinessId-nXr5wdE ()Ljava/lang/String;
public static fun getBusinessId-nXr5wdE (J)Ljava/lang/String;
public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String;
public static fun getBusinessConnectionId-nXr5wdE (J)Ljava/lang/String;
public fun getChatId-iyD94Bc ()J
public fun getThreadId-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId;
public static fun getThreadId-S3HF-10 (J)Ldev/inmo/tgbotapi/types/MessageThreadId;
@ -7381,8 +7381,8 @@ public final class dev/inmo/tgbotapi/types/ChatIdWithThreadId : dev/inmo/tgbotap
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (Lkotlin/Pair;Ljava/lang/Object;)Z
public static final fun equals-impl0 (Lkotlin/Pair;Lkotlin/Pair;)Z
public fun getBusinessId-nXr5wdE ()Ljava/lang/String;
public static fun getBusinessId-nXr5wdE (Lkotlin/Pair;)Ljava/lang/String;
public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String;
public static fun getBusinessConnectionId-nXr5wdE (Lkotlin/Pair;)Ljava/lang/String;
public fun getChatId-iyD94Bc ()J
public static fun getChatId-iyD94Bc (Lkotlin/Pair;)J
public final fun getChatIdWithThreadId ()Lkotlin/Pair;
@ -8268,7 +8268,7 @@ public final class dev/inmo/tgbotapi/types/FullChatIdentifierSerializer : kotlin
public abstract interface class dev/inmo/tgbotapi/types/IdChatIdentifier : dev/inmo/tgbotapi/types/ChatIdentifier {
public static final field Companion Ldev/inmo/tgbotapi/types/IdChatIdentifier$Companion;
public abstract fun getBusinessId-nXr5wdE ()Ljava/lang/String;
public abstract fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String;
public abstract fun getChatId-iyD94Bc ()J
public abstract fun getThreadId-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId;
}
@ -8282,7 +8282,7 @@ public final class dev/inmo/tgbotapi/types/IdChatIdentifier$Companion {
}
public final class dev/inmo/tgbotapi/types/IdChatIdentifier$DefaultImpls {
public static fun getBusinessId-nXr5wdE (Ldev/inmo/tgbotapi/types/IdChatIdentifier;)Ljava/lang/String;
public static fun getBusinessConnectionId-nXr5wdE (Ldev/inmo/tgbotapi/types/IdChatIdentifier;)Ljava/lang/String;
public static fun getThreadId-S3HF-10 (Ldev/inmo/tgbotapi/types/IdChatIdentifier;)Ldev/inmo/tgbotapi/types/MessageThreadId;
}
@ -11107,12 +11107,15 @@ public final class dev/inmo/tgbotapi/types/UpdateId$Companion {
public final class dev/inmo/tgbotapi/types/UpdateTypesKt {
public static final field UPDATE_BUSINESS_CONNECTION Ljava/lang/String;
public static final field UPDATE_BUSINESS_MESSAGE Ljava/lang/String;
public static final field UPDATE_CALLBACK_QUERY Ljava/lang/String;
public static final field UPDATE_CHANNEL_POST Ljava/lang/String;
public static final field UPDATE_CHAT_BOOST Ljava/lang/String;
public static final field UPDATE_CHAT_JOIN_REQUEST Ljava/lang/String;
public static final field UPDATE_CHAT_MEMBER Ljava/lang/String;
public static final field UPDATE_CHOSEN_INLINE_RESULT Ljava/lang/String;
public static final field UPDATE_DELETED_BUSINESS_MESSAGES Ljava/lang/String;
public static final field UPDATE_EDITED_BUSINESS_MESSAGE Ljava/lang/String;
public static final field UPDATE_EDITED_CHANNEL_POST Ljava/lang/String;
public static final field UPDATE_EDITED_MESSAGE Ljava/lang/String;
public static final field UPDATE_INLINE_QUERY Ljava/lang/String;
@ -17496,6 +17499,7 @@ public final class dev/inmo/tgbotapi/types/message/BusinessContentMessageImpl :
public fun getReplyTo ()Ldev/inmo/tgbotapi/types/message/abstracts/Message;
public fun getSenderBot ()Ldev/inmo/tgbotapi/types/chat/CommonBot;
public fun getSenderBusinessBot ()Ldev/inmo/tgbotapi/types/chat/PreviewBot;
public fun getSentByBusinessConnectionOwner ()Z
public fun getUser ()Ldev/inmo/tgbotapi/types/chat/User;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
@ -18789,6 +18793,7 @@ public abstract interface class dev/inmo/tgbotapi/types/message/abstracts/Busine
public abstract fun getBusinessConnectionId-T-_HSQI ()Ljava/lang/String;
public abstract fun getChat ()Ldev/inmo/tgbotapi/types/chat/PreviewBusinessChat;
public abstract fun getSenderBusinessBot ()Ldev/inmo/tgbotapi/types/chat/PreviewBot;
public abstract fun getSentByBusinessConnectionOwner ()Z
}
public final class dev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage$DefaultImpls {
@ -18796,6 +18801,7 @@ public final class dev/inmo/tgbotapi/types/message/abstracts/BusinessContentMess
public static fun getForwardable (Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;)Z
public static fun getMetaInfo-fV8YnZ8 (Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;)Lkotlin/Triple;
public static fun getReplyTo (Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;)Ldev/inmo/tgbotapi/types/message/abstracts/Message;
public static fun getSentByBusinessConnectionOwner (Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;)Z
public static fun getUser (Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;)Ldev/inmo/tgbotapi/types/chat/User;
}

View File

@ -19,7 +19,7 @@ data class GetChat(
@Transient
override val resultDeserializer: DeserializationStrategy<ExtendedChat> = when {
chatId is ChatIdWithThreadId -> ExtendedChatSerializer.BasedOnForumThread(chatId.threadId)
chatId is BusinessChatId -> ExtendedChatSerializer.BasedOnBusinessConnection(chatId.businessId)
chatId is BusinessChatId -> ExtendedChatSerializer.BasedOnBusinessConnection(chatId.businessConnectionId)
else -> ExtendedChatSerializer.Companion
}
override val requestSerializer: SerializationStrategy<*>

View File

@ -30,7 +30,7 @@ sealed interface IdChatIdentifier : ChatIdentifier {
abstract val chatId: RawChatId
val threadId: MessageThreadId?
get() = null
val businessId: BusinessConnectionId?
val businessConnectionId: BusinessConnectionId?
get() = null
companion object {
@ -63,7 +63,7 @@ value class ChatIdWithThreadId(val chatIdWithThreadId: Pair<RawChatId, MessageTh
value class BusinessChatId(val chatIdWithBusinessConnectionId: Pair<RawChatId, BusinessConnectionId>) : IdChatIdentifier {
override val chatId: RawChatId
get() = chatIdWithBusinessConnectionId.first
override val businessId: BusinessConnectionId
override val businessConnectionId: BusinessConnectionId
get() = chatIdWithBusinessConnectionId.second
constructor(chatId: RawChatId, businessConnectionId: BusinessConnectionId): this(chatId to businessConnectionId)
@ -196,7 +196,7 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
when (value) {
is ChatId -> encoder.encodeLong(value.chatId.long)
is ChatIdWithThreadId -> encoder.encodeString("${value.chatId}/${value.threadId}")
is BusinessChatId -> encoder.encodeString("${value.chatId}//${value.businessId}")
is BusinessChatId -> encoder.encodeString("${value.chatId}//${value.businessConnectionId}")
is Username -> encoder.encodeString(value.full)
}
}

View File

@ -2,9 +2,9 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.chat.Bot
import dev.inmo.tgbotapi.types.chat.PreviewBot
import dev.inmo.tgbotapi.types.chat.PreviewBusinessChat
import dev.inmo.tgbotapi.types.chat.PreviewPrivateChat
import dev.inmo.tgbotapi.types.message.content.MessageContent
interface BusinessContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage,
@ -12,4 +12,11 @@ interface BusinessContentMessage<T: MessageContent> : PossiblySentViaBotCommonMe
override val chat: PreviewBusinessChat
override val businessConnectionId: BusinessConnectionId
val senderBusinessBot: PreviewBot?
/**
* Currently, there are only 1-1 business chats and any message in the [chat] sent not by [PreviewBusinessChat.original]
* must be sent by bot or user
*/
val sentByBusinessConnectionOwner: Boolean
get() = chat.original.id != from.id && from !is Bot
}