@@ -26,6 +26,7 @@ import dev.inmo.tgbotapi.types.message.textsources.link
2626import dev.inmo.tgbotapi.types.message.textsources.regular
2727import dev.inmo.tgbotapi.types.message.textsources.underline
2828import dev.inmo.tgbotapi.types.update.abstracts.Update
29+ import dev.inmo.tgbotapi.utils.PreviewFeature
2930import java.time.Duration
3031import kotlinx.coroutines.CoroutineScope
3132import kotlinx.coroutines.Deferred
@@ -34,6 +35,7 @@ import kotlinx.coroutines.supervisorScope
3435import kotlinx.coroutines.time.withTimeoutOrNull
3536import org.apache.logging.log4j.LogManager
3637
38+ @OptIn(PreviewFeature ::class )
3739class ExplainerUpdateProcessor (
3840 private val languageRoomDAO : LanguageRoomDAO ,
3941 private val urbanDictionaryClient : UrbanDictionaryClient ,
@@ -45,7 +47,7 @@ class ExplainerUpdateProcessor(
4547 }
4648
4749 override suspend fun process (update : Update ) {
48- val update = update.asBaseMessageUpdate() ? : return
50+ @Suppress( " NAME_SHADOWING " ) val update = update.asBaseMessageUpdate() ? : return
4951 val roomId = update.data.chat.id
5052 val message = update.data.asContentMessage() ? : return
5153 val content = message.content.asTextContent() ? : return
@@ -58,7 +60,7 @@ class ExplainerUpdateProcessor(
5860
5961 val emphasizedWords = extractEmphasizedWords(content)
6062
61- logger.debug (" Emphasized words: $emphasizedWords " )
63+ logger.info (" Emphasized words: $emphasizedWords " )
6264
6365 val explanations = fetchExplanations(emphasizedWords)
6466
@@ -134,7 +136,7 @@ class ExplainerUpdateProcessor(
134136
135137 private fun StringBuilder.dictionaryDotDevExplanations (dictionaryDotDevExplanations : Collection <Word >? ) {
136138 dictionaryDotDevExplanations?.let { definitions ->
137- definitions.take(3 ).forEachIndexed { index , definition ->
139+ definitions.take(3 ).forEachIndexed { _ , definition ->
138140 val link = definition.sourceUrls?.firstOrNull()
139141
140142 if (link != null ) {
0 commit comments