@@ -28,6 +28,7 @@ import dev.inmo.tgbotapi.types.message.textsources.link
28
28
import dev.inmo.tgbotapi.types.message.textsources.regular
29
29
import dev.inmo.tgbotapi.types.message.textsources.underline
30
30
import dev.inmo.tgbotapi.types.update.abstracts.Update
31
+ import dev.inmo.tgbotapi.utils.PreviewFeature
31
32
import java.time.Duration
32
33
import kotlinx.coroutines.CoroutineScope
33
34
import kotlinx.coroutines.Deferred
@@ -36,6 +37,7 @@ import kotlinx.coroutines.supervisorScope
36
37
import kotlinx.coroutines.time.withTimeoutOrNull
37
38
import org.apache.logging.log4j.LogManager
38
39
40
+ @OptIn(PreviewFeature ::class )
39
41
class ExplainerUpdateProcessor (
40
42
private val languageRoomDAO : LanguageRoomDAO ,
41
43
private val urbanDictionaryClient : UrbanDictionaryClient ,
@@ -47,7 +49,7 @@ class ExplainerUpdateProcessor(
47
49
}
48
50
49
51
override suspend fun process (update : Update ) {
50
- val update = update.asBaseMessageUpdate() ? : return
52
+ @Suppress( " NAME_SHADOWING " ) val update = update.asBaseMessageUpdate() ? : return
51
53
val roomId = update.data.chat.id
52
54
val message = update.data.asContentMessage() ? : return
53
55
val content = message.content.asTextContent() ? : return
@@ -60,7 +62,7 @@ class ExplainerUpdateProcessor(
60
62
61
63
val emphasizedWords = extractEmphasizedWords(content)
62
64
63
- logger.debug (" Emphasized words: $emphasizedWords " )
65
+ logger.info (" Emphasized words: $emphasizedWords " )
64
66
65
67
val explanations = fetchExplanations(emphasizedWords)
66
68
@@ -151,7 +153,7 @@ class ExplainerUpdateProcessor(
151
153
152
154
private fun StringBuilder.dictionaryDotDevExplanations (dictionaryDotDevExplanations : Collection <Word >? ) {
153
155
dictionaryDotDevExplanations?.let { definitions ->
154
- definitions.take(3 ).forEachIndexed { index , definition ->
156
+ definitions.take(3 ).forEachIndexed { _ , definition ->
155
157
val link = definition.sourceUrls?.firstOrNull()
156
158
157
159
if (link != null ) {
0 commit comments