Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions achievements/editor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
kotlin("jvm")
}

dependencies {
api(project.projects.core)
api(libs.tgbotapi.core)
implementation(libs.log4j.api)

testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.mockk)
testRuntimeOnly(libs.junit.jupiter.engine)
testRuntimeOnly(libs.log4j.core)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package by.jprof.telegram.bot.achievements.editor

import by.jprof.telegram.bot.core.UpdateProcessor
import dev.inmo.tgbotapi.bot.RequestsExecutor
import dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
import dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate
import dev.inmo.tgbotapi.types.update.abstracts.Update
import org.apache.logging.log4j.LogManager

class EditorAchievementUpdateProcessor(
private val bot: RequestsExecutor,
) : UpdateProcessor {
companion object {
private val logger = LogManager.getLogger(EditorAchievementUpdateProcessor::class.java)!!
}

override suspend fun process(update: Update) {
@Suppress("NAME_SHADOWING")
val update = (update as? BaseEditMessageUpdate) ?: return
val message = (update.data as? FromUserMessage) ?: return

logger.debug("{} edited a message", message.user.id.chatId)

// Typo hunter
// Editor
// GLVRD
// Золотое перо
// Перфекционист
}
}
1 change: 1 addition & 0 deletions runners/lambda/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ dependencies {
implementation(project.projects.jep)
implementation(project.projects.youtube.dynamodb)
implementation(project.projects.kotlin.dynamodb)
implementation(project.projects.achievements.editor)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package by.jprof.telegram.bot.runners.lambda.config

import by.jprof.telegram.bot.achievements.editor.EditorAchievementUpdateProcessor
import by.jprof.telegram.bot.core.UpdateProcessingPipeline
import by.jprof.telegram.bot.core.UpdateProcessor
import by.jprof.telegram.bot.jep.JEPUpdateProcessor
Expand Down Expand Up @@ -37,4 +38,10 @@ val pipelineModule = module {
bot = get(),
)
}

single<UpdateProcessor>(named("EditorAchievementUpdateProcessor")) {
EditorAchievementUpdateProcessor(
bot = get(),
)
}
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ include(":core")
include(":jep")
include(":youtube")
include(":youtube:dynamodb")
include(":achievements:editor")
include(":kotlin")
include(":kotlin:dynamodb")
include(":runners:lambda")