1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00
This commit is contained in:
InsanusMokrassar 2024-01-05 20:30:07 +06:00
parent 825ecc1d73
commit e66537ee32
4 changed files with 73 additions and 13 deletions

View File

@ -232,6 +232,10 @@ const val hasPrivateForwardsField = "has_private_forwards"
const val hasRestrictedVoiceAndVideoMessagesField = "has_restricted_voice_and_video_messages"
const val emojiStatusCustomEmojiIdField = "emoji_status_custom_emoji_id"
const val emojiStatusExpirationDateField = "emoji_status_expiration_date"
const val accentColorIdField = "accent_color_id"
const val profileAccentColorIdField = "profile_accent_color_id"
const val backgroundCustomEmojiIdField = "background_custom_emoji_id"
const val profileBackgroundCustomEmojiIdField = "profile_background_custom_emoji_id"
const val iconCustomEmojiIdField = "icon_custom_emoji_id"
const val canJoinGroupsField = "can_join_groups"
const val canReadAllGroupMessagesField = "can_read_all_group_messages"

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.types.chat
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.colors.ColorId
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer
import dev.inmo.tgbotapi.types.reactions.Reaction
@ -39,7 +40,15 @@ data class ExtendedChannelChatImpl(
@SerialName(emojiStatusCustomEmojiIdField)
override val statusEmojiId: CustomEmojiId? = null,
@SerialName(emojiStatusExpirationDateField)
override val statusEmojiExpiration: TelegramDate? = null
override val statusEmojiExpiration: TelegramDate? = null,
@SerialName(accentColorIdField)
override val accentColorId: ColorId = ColorId(0),
@SerialName(profileAccentColorIdField)
override val profileAccentColorId: ColorId? = null,
@SerialName(backgroundCustomEmojiIdField)
override val backgroundCustomEmojiId: CustomEmojiId? = null,
@SerialName(profileBackgroundCustomEmojiIdField)
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
) : ExtendedChannelChat
@Serializable
@ -67,7 +76,15 @@ data class ExtendedGroupChatImpl(
@SerialName(emojiStatusCustomEmojiIdField)
override val statusEmojiId: CustomEmojiId? = null,
@SerialName(emojiStatusExpirationDateField)
override val statusEmojiExpiration: TelegramDate? = null
override val statusEmojiExpiration: TelegramDate? = null,
@SerialName(accentColorIdField)
override val accentColorId: ColorId = ColorId(0),
@SerialName(profileAccentColorIdField)
override val profileAccentColorId: ColorId? = null,
@SerialName(backgroundCustomEmojiIdField)
override val backgroundCustomEmojiId: CustomEmojiId? = null,
@SerialName(profileBackgroundCustomEmojiIdField)
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
) : ExtendedGroupChat
@Serializable
@ -94,7 +111,15 @@ data class ExtendedPrivateChatImpl(
@SerialName(emojiStatusCustomEmojiIdField)
override val statusEmojiId: CustomEmojiId? = null,
@SerialName(emojiStatusExpirationDateField)
override val statusEmojiExpiration: TelegramDate? = null
override val statusEmojiExpiration: TelegramDate? = null,
@SerialName(accentColorIdField)
override val accentColorId: ColorId = ColorId(0),
@SerialName(profileAccentColorIdField)
override val profileAccentColorId: ColorId? = null,
@SerialName(backgroundCustomEmojiIdField)
override val backgroundCustomEmojiId: CustomEmojiId? = null,
@SerialName(profileBackgroundCustomEmojiIdField)
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
) : ExtendedPrivateChat
typealias ExtendedUser = ExtendedPrivateChatImpl
@ -144,7 +169,15 @@ data class ExtendedSupergroupChatImpl(
@SerialName(emojiStatusCustomEmojiIdField)
override val statusEmojiId: CustomEmojiId? = null,
@SerialName(emojiStatusExpirationDateField)
override val statusEmojiExpiration: TelegramDate? = null
override val statusEmojiExpiration: TelegramDate? = null,
@SerialName(accentColorIdField)
override val accentColorId: ColorId = ColorId(0),
@SerialName(profileAccentColorIdField)
override val profileAccentColorId: ColorId? = null,
@SerialName(backgroundCustomEmojiIdField)
override val backgroundCustomEmojiId: CustomEmojiId? = null,
@SerialName(profileBackgroundCustomEmojiIdField)
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
) : ExtendedSupergroupChat
@Serializable
@ -192,7 +225,15 @@ data class ExtendedForumChatImpl(
@SerialName(emojiStatusCustomEmojiIdField)
override val statusEmojiId: CustomEmojiId? = null,
@SerialName(emojiStatusExpirationDateField)
override val statusEmojiExpiration: TelegramDate? = null
override val statusEmojiExpiration: TelegramDate? = null,
@SerialName(accentColorIdField)
override val accentColorId: ColorId = ColorId(0),
@SerialName(profileAccentColorIdField)
override val profileAccentColorId: ColorId? = null,
@SerialName(backgroundCustomEmojiIdField)
override val backgroundCustomEmojiId: CustomEmojiId? = null,
@SerialName(profileBackgroundCustomEmojiIdField)
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
) : ExtendedForumChat
@Serializable
@ -211,7 +252,15 @@ data class ExtendedBot(
@SerialName(supportInlineQueriesField)
val supportsInlineQueries: Boolean = false,
@SerialName(photoField)
override val chatPhoto: ChatPhoto? = null
override val chatPhoto: ChatPhoto? = null,
@SerialName(accentColorIdField)
override val accentColorId: ColorId = ColorId(0),
@SerialName(profileAccentColorIdField)
override val profileAccentColorId: ColorId? = null,
@SerialName(backgroundCustomEmojiIdField)
override val backgroundCustomEmojiId: CustomEmojiId? = null,
@SerialName(profileBackgroundCustomEmojiIdField)
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
) : Bot(), ExtendedChat {
@SerialName(isBotField)
private val isBot = true
@ -223,4 +272,12 @@ data class UnknownExtendedChat(
val rawJson: JsonObject
) : ExtendedChat {
override val chatPhoto: ChatPhoto? = null
@SerialName(accentColorIdField)
override val accentColorId: ColorId = ColorId(0)
@SerialName(profileAccentColorIdField)
override val profileAccentColorId: ColorId? = null
@SerialName(backgroundCustomEmojiIdField)
override val backgroundCustomEmojiId: CustomEmojiId? = null
@SerialName(profileBackgroundCustomEmojiIdField)
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,\
}

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.types.chat
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.colors.ColorId
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer
import dev.inmo.tgbotapi.types.reactions.Reaction
@ -10,6 +11,10 @@ import kotlinx.serialization.Serializable
@Serializable(ExtendedChatSerializer.Companion::class)
sealed interface ExtendedChat : Chat {
val chatPhoto: ChatPhoto?
val accentColorId: ColorId
val profileAccentColorId: ColorId?
val backgroundCustomEmojiId: CustomEmojiId?
val profileBackgroundCustomEmojiId: CustomEmojiId?
}
@Serializable(ExtendedChatSerializer.Companion::class)

View File

@ -8,10 +8,4 @@ import kotlin.jvm.JvmInline
@JvmInline
value class ColorId(
val int: Int
) {
companion object {
val defaultAccentColors = mapOf(
ColorId(0) to setOf(HEXAColor(0xff0000ffu)),
)
}
}
)