mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-16 13:49:26 +00:00
update webapps support
This commit is contained in:
@@ -65,7 +65,8 @@ object PreviewChatSerializer : KSerializer<Chat> {
|
||||
ChatType.ChannelChatType -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
||||
is ChatType.UnknownChatType -> UnknownChatType(
|
||||
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
||||
decodedJson.toString()
|
||||
decodedJson.toString(),
|
||||
decodedJson
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -77,6 +78,10 @@ object PreviewChatSerializer : KSerializer<Chat> {
|
||||
is GroupChatImpl -> GroupChatImpl.serializer().serialize(encoder, value)
|
||||
is SupergroupChatImpl -> SupergroupChatImpl.serializer().serialize(encoder, value)
|
||||
is ChannelChatImpl -> ChannelChatImpl.serializer().serialize(encoder, value)
|
||||
is CommonBot -> CommonBot.serializer().serialize(encoder, value)
|
||||
is ExtendedBot -> ExtendedBot.serializer().serialize(encoder, value)
|
||||
is CommonUser -> CommonUser.serializer().serialize(encoder, value)
|
||||
is UnknownChatType -> JsonObject.serializer().serialize(encoder, value.rawJson)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,7 +104,8 @@ object ExtendedChatSerializer : KSerializer<ExtendedChat> {
|
||||
ChatType.ChannelChatType -> formatter.decodeFromJsonElement(ExtendedChannelChatImpl.serializer(), decodedJson)
|
||||
is ChatType.UnknownChatType -> UnknownExtendedChat(
|
||||
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
||||
decodedJson.toString()
|
||||
decodedJson.toString(),
|
||||
decodedJson
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -110,6 +116,7 @@ object ExtendedChatSerializer : KSerializer<ExtendedChat> {
|
||||
is ExtendedGroupChatImpl -> ExtendedGroupChatImpl.serializer().serialize(encoder, value)
|
||||
is ExtendedSupergroupChatImpl -> ExtendedSupergroupChatImpl.serializer().serialize(encoder, value)
|
||||
is ExtendedChannelChatImpl -> ExtendedChannelChatImpl.serializer().serialize(encoder, value)
|
||||
is UnknownExtendedChat -> JsonObject.serializer().serialize(encoder, value.rawJson)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
@Serializable
|
||||
data class ExtendedChannelChatImpl(
|
||||
@@ -119,7 +120,8 @@ data class ExtendedBot(
|
||||
|
||||
data class UnknownExtendedChat(
|
||||
override val id: ChatId,
|
||||
val raw: String
|
||||
val raw: String,
|
||||
val rawJson: JsonObject
|
||||
) : ExtendedChat {
|
||||
override val chatPhoto: ChatPhoto? = null
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
package dev.inmo.tgbotapi.types.chat
|
||||
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
data class UnknownChatType(
|
||||
override val id: ChatId,
|
||||
val raw: String
|
||||
val raw: String,
|
||||
val rawJson: JsonObject
|
||||
) : Chat
|
||||
|
Reference in New Issue
Block a user