Skip to content

Commit

Permalink
Revert "analysis module"
Browse files Browse the repository at this point in the history
This reverts commit aa1e7c9.
  • Loading branch information
demidko committed Sep 27, 2024
1 parent aa1e7c9 commit 90e4d10
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 75 deletions.
11 changes: 3 additions & 8 deletions src/main/kotlin/com/github/demidko/glock/ApplicationFactory.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.demidko.glock

import com.github.kotlintelegrambot.entities.ChatId.Companion.fromId
import com.github.kotlintelegrambot.entities.ChatPermissions
import com.sksamuel.hoplite.ConfigLoaderBuilder
import com.sksamuel.hoplite.ExperimentalHoplite
Expand All @@ -12,10 +13,9 @@ import kotlin.time.toKotlinDuration
open class ApplicationFactory {
data class Config(
val botToken: String,
val excludedChatsUsernames: Set<String>,
val healingConstant: Long = 7,
val healingTimeZone: String = "Asia/Jerusalem",
val restrictionsDuration: Duration = ofMinutes(5),
val restrictionsDuration: Duration = ofMinutes(5)
)

@OptIn(ExperimentalHoplite::class)
Expand Down Expand Up @@ -43,18 +43,13 @@ open class ApplicationFactory {
canPinMessages = false
)

open val spyModule by lazy {
SpyModule(config.excludedChatsUsernames)
}

open val glockBot by lazy {
GlockBot(
config.botToken,
restrictions,
config.restrictionsDuration,
config.healingConstant,
ZoneId.of(config.healingTimeZone),
spyModule
ZoneId.of(config.healingTimeZone)
)
}
}
11 changes: 3 additions & 8 deletions src/main/kotlin/com/github/demidko/glock/GlockBot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.github.kotlintelegrambot.dispatcher.message
import com.github.kotlintelegrambot.entities.ChatId.Companion.fromId
import com.github.kotlintelegrambot.entities.ChatPermissions
import com.github.kotlintelegrambot.entities.Message
import java.io.Closeable
import java.lang.Thread.startVirtualThread
import java.time.Duration
import java.time.Duration.ofDays
Expand All @@ -21,8 +22,7 @@ class GlockBot(
private val restrictions: ChatPermissions,
private val restrictionsDuration: Duration,
private val healingConstant: Long,
private val healingTimeZone: ZoneId,
private val spyModule: SpyModule
private val healingTimeZone: ZoneId
) {

init {
Expand All @@ -43,11 +43,6 @@ class GlockBot(
command("help", handleCommand(ChatOps::help))
command("start", handleCommand(ChatOps::help))
message(handleMessage(ChatOps::tryProcessStatuette))
message {
startVirtualThread {
spyModule.spy(message)
}
}
}
}

Expand All @@ -56,7 +51,7 @@ class GlockBot(
private var previousChatsCount = 0

fun cleanTempMessages() {
if (idToChatOps.count() > previousChatsCount) {
if(idToChatOps.count() > previousChatsCount) {
previousChatsCount = idToChatOps.count()
println("Bot has $previousChatsCount chats")
}
Expand Down
59 changes: 0 additions & 59 deletions src/main/kotlin/com/github/demidko/glock/SpyModule.kt

This file was deleted.

0 comments on commit 90e4d10

Please sign in to comment.