io.github.dehuckakpyt.telegrambot.source.message.DatabaseTelegramMessageSource.kt Maven / Gradle / Ivy
package io.github.dehuckakpyt.telegrambot.source.message
import io.github.dehuckakpyt.telegrambot.model.message.DatabaseTelegramMessage
import io.github.dehuckakpyt.telegrambot.repository.message.DatabaseTelegramMessageRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
open class DatabaseTelegramMessageSource(
private val repository: DatabaseTelegramMessageRepository,
) : MessageSource {
override suspend fun save(chatId: Long, fromId: Long, fromBot: Boolean, messageId: Long, type: String, step: String?, stepContainerType: String?, text: String?, fileIds: List?): Unit = withContext(Dispatchers.IO) {
repository.save(
DatabaseTelegramMessage(
chatId = chatId,
fromId = fromId,
fromBot = fromBot,
messageId = messageId,
type = type,
step = step,
stepContainerType = stepContainerType,
text = text,
fileIds = fileIds,
)
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy