mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2024-12-22 05:57:13 +00:00
add opportunity to trigger autoclean
This commit is contained in:
parent
0f958f94cb
commit
edc75a09ee
@ -7,13 +7,18 @@ import dev.inmo.krontab.toSchedule
|
||||
import dev.inmo.krontab.utils.asFlowWithDelays
|
||||
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
||||
import dev.inmo.micro_utils.koin.singleWithRandomQualifier
|
||||
import dev.inmo.micro_utils.repos.*
|
||||
import dev.inmo.plagubot.Plugin
|
||||
import dev.inmo.plagubot.plugins.inline.queries.models.Format
|
||||
import dev.inmo.plagubot.plugins.inline.queries.models.OfferTemplate
|
||||
import dev.inmo.plagubot.plugins.inline.queries.repos.InlineTemplatesRepo
|
||||
import dev.inmo.plaguposter.posts.models.PostId
|
||||
import dev.inmo.plaguposter.posts.repo.PostsRepo
|
||||
import dev.inmo.plaguposter.ratings.models.Rating
|
||||
import dev.inmo.plaguposter.ratings.repo.RatingsRepo
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommand
|
||||
import dev.inmo.tgbotapi.types.Seconds
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.*
|
||||
@ -75,6 +80,13 @@ object Plugin : Plugin {
|
||||
autoclear.autoClearKrontab.toSchedule().asFlowWithDelays().subscribeSafelyWithoutExceptions(scope) {
|
||||
doAutoClear()
|
||||
}
|
||||
|
||||
onCommand("clean_posts_by_ratings") {
|
||||
doAutoClear()
|
||||
}
|
||||
koin.getOrNull<InlineTemplatesRepo>() ?.addTemplate(
|
||||
OfferTemplate("Force autoclear", listOf(Format("/clean_posts_by_ratings")))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user