File tree Expand file tree Collapse file tree 5 files changed +57
-1
lines changed
src/main/kotlin/by/jprof/telegram/bot/eval
src/main/kotlin/by/jprof/telegram/bot/runners/lambda/config Expand file tree Collapse file tree 5 files changed +57
-1
lines changed Original file line number Diff line number Diff line change 1+ plugins {
2+ kotlin(" jvm" )
3+ }
4+
5+ dependencies {
6+ api(project.projects.core)
7+ api(libs.tgbotapi.core)
8+ implementation(project.projects.votes.tgbotapiExtensions)
9+ implementation(libs.tgbotapi.extensions.api)
10+ implementation(libs.tgbotapi.extensions.utils)
11+ implementation(libs.log4j.api)
12+
13+ testImplementation(libs.junit.jupiter.api)
14+ testImplementation(libs.junit.jupiter.params)
15+ testImplementation(libs.mockk)
16+ testRuntimeOnly(libs.junit.jupiter.engine)
17+ testRuntimeOnly(libs.log4j.core)
18+ }
Original file line number Diff line number Diff line change 1+ package by.jprof.telegram.bot.eval
2+
3+ import by.jprof.telegram.bot.core.UpdateProcessor
4+ import dev.inmo.tgbotapi.extensions.utils.asBaseMessageUpdate
5+ import dev.inmo.tgbotapi.extensions.utils.asContentMessage
6+ import dev.inmo.tgbotapi.extensions.utils.asPreTextSource
7+ import dev.inmo.tgbotapi.extensions.utils.asTextContent
8+ import dev.inmo.tgbotapi.types.update.abstracts.Update
9+ import org.apache.logging.log4j.LogManager
10+
11+ class EvalUpdateProcessor : UpdateProcessor {
12+ companion object {
13+ private val logger = LogManager .getLogger(EvalUpdateProcessor ::class .java)!!
14+ }
15+
16+ override suspend fun process (update : Update ) {
17+ val message = update.asBaseMessageUpdate() ? : return
18+ val content = message.data.asContentMessage() ? : return
19+ val text = content.content.asTextContent() ? : return
20+ val codes = text.textSources.mapNotNull { it.asPreTextSource() }
21+
22+ codes.forEach {
23+ logger.debug(it)
24+ }
25+ }
26+ }
Original file line number Diff line number Diff line change @@ -15,4 +15,5 @@ dependencies {
1515 implementation(project.projects.kotlin.dynamodb)
1616 implementation(project.projects.dialogs.dynamodb)
1717 implementation(project.projects.quizoji.dynamodb)
18+ implementation(project.projects.eval)
1819}
Original file line number Diff line number Diff line change @@ -2,10 +2,16 @@ package by.jprof.telegram.bot.runners.lambda.config
22
33import by.jprof.telegram.bot.core.UpdateProcessingPipeline
44import by.jprof.telegram.bot.core.UpdateProcessor
5+ import by.jprof.telegram.bot.eval.EvalUpdateProcessor
56import by.jprof.telegram.bot.jep.JEPUpdateProcessor
67import by.jprof.telegram.bot.jep.JsoupJEPSummary
78import by.jprof.telegram.bot.kotlin.KotlinMentionsUpdateProcessor
8- import by.jprof.telegram.bot.quizoji.*
9+ import by.jprof.telegram.bot.quizoji.QuizojiDoneCommandUpdateProcessor
10+ import by.jprof.telegram.bot.quizoji.QuizojiInlineQueryUpdateProcessor
11+ import by.jprof.telegram.bot.quizoji.QuizojiOptionUpdateProcessor
12+ import by.jprof.telegram.bot.quizoji.QuizojiQuestionUpdateProcessor
13+ import by.jprof.telegram.bot.quizoji.QuizojiStartCommandUpdateProcessor
14+ import by.jprof.telegram.bot.quizoji.QuizojiVoteUpdateProcessor
915import by.jprof.telegram.bot.youtube.YouTubeUpdateProcessor
1016import org.koin.core.qualifier.named
1117import org.koin.dsl.module
@@ -83,4 +89,8 @@ val pipelineModule = module {
8389 bot = get(),
8490 )
8591 }
92+
93+ single<UpdateProcessor >(named(" EvalUpdateProcessor" )) {
94+ EvalUpdateProcessor ()
95+ }
8696}
Original file line number Diff line number Diff line change @@ -20,4 +20,5 @@ include(":kotlin")
2020include(" :kotlin:dynamodb" )
2121include(" :quizoji" )
2222include(" :quizoji:dynamodb" )
23+ include(" :eval" )
2324include(" :runners:lambda" )
You can’t perform that action at this time.
0 commit comments