mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2025-09-16 13:39:30 +00:00
updates and fixes
This commit is contained in:
@@ -23,6 +23,7 @@ import dev.inmo.tgbotapi.extensions.utils.extensions.sameMessage
|
||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.dataButton
|
||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.flatInlineKeyboard
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
@@ -108,7 +109,7 @@ object Plugin : Plugin {
|
||||
|
||||
suspend fun refreshPostMessage(
|
||||
postId: PostId,
|
||||
chatId: ChatId,
|
||||
chatId: IdChatIdentifier,
|
||||
messageId: MessageIdentifier
|
||||
) {
|
||||
val post = postsRepo.getById(postId) ?: return
|
||||
|
@@ -5,18 +5,20 @@ import dev.inmo.micro_utils.repos.exposed.keyvalue.ExposedKeyValueRepo
|
||||
import dev.inmo.micro_utils.repos.mappers.withMapper
|
||||
import dev.inmo.plaguposter.posts.models.PostId
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.FullChatIdentifierSerializer
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import kotlinx.serialization.builtins.PairSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.jetbrains.exposed.sql.Database
|
||||
|
||||
private val ChatIdToMessageSerializer = PairSerializer(ChatId.serializer(), MessageIdentifier.serializer())
|
||||
private val ChatIdToMessageSerializer = PairSerializer(FullChatIdentifierSerializer, MessageIdentifier.serializer())
|
||||
|
||||
fun PostsMessages(
|
||||
database: Database,
|
||||
json: Json
|
||||
): KeyValueRepo<PostId, Pair<ChatId, MessageIdentifier>> = ExposedKeyValueRepo<String, String>(
|
||||
): KeyValueRepo<PostId, Pair<IdChatIdentifier, MessageIdentifier>> = ExposedKeyValueRepo<String, String>(
|
||||
database,
|
||||
{ text("postId") },
|
||||
{ text("chatToMessage") },
|
||||
@@ -25,5 +27,5 @@ fun PostsMessages(
|
||||
{ string },
|
||||
{ json.encodeToString(ChatIdToMessageSerializer, this) },
|
||||
{ PostId(this) },
|
||||
{ json.decodeFromString(ChatIdToMessageSerializer, this) }
|
||||
{ json.decodeFromString(ChatIdToMessageSerializer, this) as Pair<IdChatIdentifier, MessageIdentifier> }
|
||||
)
|
||||
|
Reference in New Issue
Block a user