diff --git a/cache/admins/micro_utils/src/jvmMain/kotlin/dev/inmo/tgbotapi/libraries/cache/admins/AdminsCacheAPI.kt b/cache/admins/micro_utils/src/jvmMain/kotlin/dev/inmo/tgbotapi/libraries/cache/admins/AdminsCacheAPI.kt index 83549c7..9650bc2 100644 --- a/cache/admins/micro_utils/src/jvmMain/kotlin/dev/inmo/tgbotapi/libraries/cache/admins/AdminsCacheAPI.kt +++ b/cache/admins/micro_utils/src/jvmMain/kotlin/dev/inmo/tgbotapi/libraries/cache/admins/AdminsCacheAPI.kt @@ -38,8 +38,8 @@ fun TelegramBot.createAdminsCacheAPI( { long("chatId") }, { text("member") }, "AdminsTable" - ).withMapper( - keyFromToTo = { chatId }, + ).withMapper( + keyFromToTo = { chatId.long }, valueFromToTo = { telegramAdminsSerializationFormat.encodeToString(AdministratorChatMember.serializer(), this) }, keyToToFrom = { toChatId() }, valueToToFrom = { telegramAdminsSerializationFormat.decodeFromString(AdministratorChatMember.serializer(), this) } @@ -49,8 +49,8 @@ fun TelegramBot.createAdminsCacheAPI( { long("chatId") }, { long("datetime") }, "AdminsUpdatesTimesTable" - ).withMapper( - keyFromToTo = { chatId }, + ).withMapper( + keyFromToTo = { chatId.long }, valueFromToTo = { this }, keyToToFrom = { toChatId() }, valueToToFrom = { this } @@ -63,8 +63,8 @@ fun TelegramBot.createAdminsCacheAPI( { long("chatId") }, { text("settings") }, "DynamicAdminsCacheSettingsAPI" - ).withMapper( - keyFromToTo = { chatId }, + ).withMapper( + keyFromToTo = { chatId.long }, valueFromToTo = { telegramAdminsSerializationFormat.encodeToString(AdminsCacheSettings.serializer() , this) }, keyToToFrom = { toChatId() }, valueToToFrom = { telegramAdminsSerializationFormat.decodeFromString(AdminsCacheSettings.serializer() , this) } diff --git a/cache/admins/plagubot/src/jvmMain/kotlin/dev/inmo/tgbotapi/libraries/cache/admins/AdminsPlugin.kt b/cache/admins/plagubot/src/jvmMain/kotlin/dev/inmo/tgbotapi/libraries/cache/admins/AdminsPlugin.kt index d157c6a..a7ec050 100644 --- a/cache/admins/plagubot/src/jvmMain/kotlin/dev/inmo/tgbotapi/libraries/cache/admins/AdminsPlugin.kt +++ b/cache/admins/plagubot/src/jvmMain/kotlin/dev/inmo/tgbotapi/libraries/cache/admins/AdminsPlugin.kt @@ -55,8 +55,8 @@ class AdminsPlugin : Plugin { { long("chatId") }, { text("member") }, "AdminsTable" - ).withMapper( - keyFromToTo = { chatId }, + ).withMapper( + keyFromToTo = { chatId.long }, valueFromToTo = { telegramAdminsSerializationFormat.encodeToString(this) }, keyToToFrom = { toChatId() }, valueToToFrom = { telegramAdminsSerializationFormat.decodeFromString(this) } @@ -66,8 +66,8 @@ class AdminsPlugin : Plugin { { long("chatId") }, { long("datetime") }, "AdminsUpdatesTimesTable" - ).withMapper( - keyFromToTo = { chatId }, + ).withMapper( + keyFromToTo = { chatId.long }, valueFromToTo = { this }, keyToToFrom = { toChatId() }, valueToToFrom = { this } @@ -82,8 +82,8 @@ class AdminsPlugin : Plugin { { long("chatId") }, { text("settings") }, "DynamicAdminsCacheSettingsAPI" - ).withMapper( - keyFromToTo = { chatId }, + ).withMapper( + keyFromToTo = { chatId.long }, valueFromToTo = { telegramAdminsSerializationFormat.encodeToString(this) }, keyToToFrom = { toChatId() }, valueToToFrom = { telegramAdminsSerializationFormat.decodeFromString(this) } diff --git a/cache/content/micro_utils/src/commonMain/kotlin/dev/inmo/tgbotapi/libraries/cache/media/micro_utils/SimpleKeyValueMessageContentCache.kt b/cache/content/micro_utils/src/commonMain/kotlin/dev/inmo/tgbotapi/libraries/cache/media/micro_utils/SimpleKeyValueMessageContentCache.kt index 0953cdf..9a27443 100644 --- a/cache/content/micro_utils/src/commonMain/kotlin/dev/inmo/tgbotapi/libraries/cache/media/micro_utils/SimpleKeyValueMessageContentCache.kt +++ b/cache/content/micro_utils/src/commonMain/kotlin/dev/inmo/tgbotapi/libraries/cache/media/micro_utils/SimpleKeyValueMessageContentCache.kt @@ -4,7 +4,7 @@ import dev.inmo.micro_utils.repos.* import dev.inmo.micro_utils.repos.mappers.withMapper import dev.inmo.tgbotapi.libraries.cache.media.common.MessagesSimpleCache import dev.inmo.tgbotapi.types.ChatId -import dev.inmo.tgbotapi.types.MessageIdentifier +import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.message.content.MessageContent import kotlinx.serialization.* import kotlinx.serialization.builtins.PairSerializer @@ -47,7 +47,7 @@ class SimpleKeyValueMessageContentCache( val chatIdToMessageIdentifierSerializer = PairSerializer( ChatId.serializer(), - MessageIdentifier.serializer() + MessageId.serializer() ) val messageContentSerializer = PolymorphicSerializer(MessageContent::class) @@ -56,9 +56,9 @@ inline fun KeyValueRepo.asMessageContentCache() = SimpleK inline fun KeyValueRepo.asMessageContentCache( serialFormatCreator: (SerializersModule) -> StringFormat = { Json { serializersModule = it } } -): StandardKeyValueRepo, MessageContent> { +): StandardKeyValueRepo, MessageContent> { val serialFormat = serialFormatCreator(MessageContent.serializationModule()) - return withMapper, MessageContent, String, String>( + return withMapper, MessageContent, String, String>( { serialFormat.encodeToString(chatIdToMessageIdentifierSerializer, this) }, { serialFormat.encodeToString(messageContentSerializer, this) }, { serialFormat.decodeFromString(chatIdToMessageIdentifierSerializer, this) }, @@ -70,9 +70,9 @@ inline fun KeyValueRepo.asMessageContentCache( @JsName("stringsKeyValueAsHexMessageContentCache") inline fun KeyValueRepo.asMessageContentCache( serialFormatCreator: (SerializersModule) -> BinaryFormat -): StandardKeyValueRepo, MessageContent> { +): StandardKeyValueRepo, MessageContent> { val serialFormat = serialFormatCreator(MessageContent.serializationModule()) - return withMapper, MessageContent, String, String>( + return withMapper, MessageContent, String, String>( { serialFormat.encodeToHexString(chatIdToMessageIdentifierSerializer, this) }, { serialFormat.encodeToHexString(messageContentSerializer, this) }, { serialFormat.decodeFromHexString(chatIdToMessageIdentifierSerializer, this) }, @@ -84,9 +84,9 @@ inline fun KeyValueRepo.asMessageContentCache( @JsName("bytesKeyValueAsMessageContentCache") inline fun KeyValueRepo.asMessageContentCache( serialFormatCreator: (SerializersModule) -> BinaryFormat -): StandardKeyValueRepo, MessageContent> { +): StandardKeyValueRepo, MessageContent> { val serialFormat = serialFormatCreator(MessageContent.serializationModule()) - return withMapper, MessageContent, ByteArray, ByteArray>( + return withMapper, MessageContent, ByteArray, ByteArray>( { serialFormat.encodeToByteArray(chatIdToMessageIdentifierSerializer, this) }, { serialFormat.encodeToByteArray(messageContentSerializer, this) }, { serialFormat.decodeFromByteArray(chatIdToMessageIdentifierSerializer, this) }, diff --git a/resender/src/commonMain/kotlin/MessageMetaInfo.kt b/resender/src/commonMain/kotlin/MessageMetaInfo.kt index 8b794e0..a155a84 100644 --- a/resender/src/commonMain/kotlin/MessageMetaInfo.kt +++ b/resender/src/commonMain/kotlin/MessageMetaInfo.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.libraries.resender import dev.inmo.tgbotapi.types.FullChatIdentifierSerializer import dev.inmo.tgbotapi.types.IdChatIdentifier +import dev.inmo.tgbotapi.types.MediaGroupId import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.Message @@ -14,7 +15,7 @@ data class MessageMetaInfo( @Serializable(FullChatIdentifierSerializer::class) val chatId: IdChatIdentifier, val messageId: MessageId, - val group: String? = null + val group: MediaGroupId? = null ) { val metaInfo: Message.MetaInfo get() = Message.MetaInfo(chatId, messageId)