File tree Expand file tree Collapse file tree 5 files changed +48
-0
lines changed
src/main/kotlin/by/jprof/telegram/bot/achievements/editor
src/main/kotlin/by/jprof/telegram/bot/runners/lambda/config Expand file tree Collapse file tree 5 files changed +48
-0
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(libs.log4j.api)
9+
10+ testImplementation(libs.junit.jupiter.api)
11+ testImplementation(libs.junit.jupiter.params)
12+ testImplementation(libs.mockk)
13+ testRuntimeOnly(libs.junit.jupiter.engine)
14+ testRuntimeOnly(libs.log4j.core)
15+ }
Original file line number Diff line number Diff line change 1+ package by.jprof.telegram.bot.achievements.editor
2+
3+ import by.jprof.telegram.bot.core.UpdateProcessor
4+ import dev.inmo.tgbotapi.bot.RequestsExecutor
5+ import dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
6+ import dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate
7+ import dev.inmo.tgbotapi.types.update.abstracts.Update
8+ import org.apache.logging.log4j.LogManager
9+
10+ class EditorAchievementUpdateProcessor (
11+ private val bot : RequestsExecutor ,
12+ ) : UpdateProcessor {
13+ companion object {
14+ private val logger = LogManager .getLogger(EditorAchievementUpdateProcessor ::class .java)!!
15+ }
16+
17+ override suspend fun process (update : Update ) {
18+ @Suppress(" NAME_SHADOWING" )
19+ val update = (update as ? BaseEditMessageUpdate ) ? : return
20+ val message = (update.data as ? FromUserMessage ) ? : return
21+
22+ logger.debug(" {} edited a message" , message.user.id)
23+ }
24+ }
Original file line number Diff line number Diff line change @@ -13,4 +13,5 @@ dependencies {
1313 implementation(project.projects.jep)
1414 implementation(project.projects.youtube.dynamodb)
1515 implementation(project.projects.kotlin.dynamodb)
16+ implementation(project.projects.achievements.editor)
1617}
Original file line number Diff line number Diff line change 11package by.jprof.telegram.bot.runners.lambda.config
22
3+ import by.jprof.telegram.bot.achievements.editor.EditorAchievementUpdateProcessor
34import by.jprof.telegram.bot.core.UpdateProcessingPipeline
45import by.jprof.telegram.bot.core.UpdateProcessor
56import by.jprof.telegram.bot.jep.JEPUpdateProcessor
@@ -37,4 +38,10 @@ val pipelineModule = module {
3738 bot = get(),
3839 )
3940 }
41+
42+ single<UpdateProcessor >(named(" EditorAchievementUpdateProcessor" )) {
43+ EditorAchievementUpdateProcessor (
44+ bot = get(),
45+ )
46+ }
4047}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ include(":core")
1313include(" :jep" )
1414include(" :youtube" )
1515include(" :youtube:dynamodb" )
16+ include(" :achievements:editor" )
1617include(" :kotlin" )
1718include(" :kotlin:dynamodb" )
1819include(" :runners:lambda" )
You can’t perform that action at this time.
0 commit comments