@@ -28,6 +28,7 @@ import dev.inmo.tgbotapi.types.message.textsources.link
2828import dev.inmo.tgbotapi.types.message.textsources.regular
2929import dev.inmo.tgbotapi.types.message.textsources.underline
3030import dev.inmo.tgbotapi.types.update.abstracts.Update
31+ import dev.inmo.tgbotapi.utils.PreviewFeature
3132import java.time.Duration
3233import kotlinx.coroutines.CoroutineScope
3334import kotlinx.coroutines.Deferred
@@ -36,6 +37,7 @@ import kotlinx.coroutines.supervisorScope
3637import kotlinx.coroutines.time.withTimeoutOrNull
3738import org.apache.logging.log4j.LogManager
3839
40+ @OptIn(PreviewFeature ::class )
3941class ExplainerUpdateProcessor (
4042 private val languageRoomDAO : LanguageRoomDAO ,
4143 private val urbanDictionaryClient : UrbanDictionaryClient ,
@@ -47,7 +49,7 @@ class ExplainerUpdateProcessor(
4749 }
4850
4951 override suspend fun process (update : Update ) {
50- val update = update.asBaseMessageUpdate() ? : return
52+ @Suppress( " NAME_SHADOWING " ) val update = update.asBaseMessageUpdate() ? : return
5153 val roomId = update.data.chat.id
5254 val message = update.data.asContentMessage() ? : return
5355 val content = message.content.asTextContent() ? : return
@@ -60,7 +62,7 @@ class ExplainerUpdateProcessor(
6062
6163 val emphasizedWords = extractEmphasizedWords(content)
6264
63- logger.debug (" Emphasized words: $emphasizedWords " )
65+ logger.info (" Emphasized words: $emphasizedWords " )
6466
6567 val explanations = fetchExplanations(emphasizedWords)
6668
@@ -151,7 +153,7 @@ class ExplainerUpdateProcessor(
151153
152154 private fun StringBuilder.dictionaryDotDevExplanations (dictionaryDotDevExplanations : Collection <Word >? ) {
153155 dictionaryDotDevExplanations?.let { definitions ->
154- definitions.take(3 ).forEachIndexed { index , definition ->
156+ definitions.take(3 ).forEachIndexed { _ , definition ->
155157 val link = definition.sourceUrls?.firstOrNull()
156158
157159 if (link != null ) {
0 commit comments