fill README

This commit is contained in:
2022-07-09 21:09:13 +06:00
parent 0dcf9086c4
commit a2345fe496
3 changed files with 86 additions and 7 deletions

View File

@@ -34,7 +34,7 @@ class CommandsPlugin : Plugin {
runCatchingSafely {
commands ?.let {
setMyCommands(
commands,
commands.distinctBy { it.command },
key.scope,
key.languageCode
)
@@ -58,7 +58,7 @@ class CommandsPlugin : Plugin {
* take all the available keys in the [CommandsKeeper] and set commands for each key
*/
override suspend fun BehaviourContext.setupBotPlugin(koin: Koin) {
val commandsKeeper = koin.get<CommandsKeeper>()
val commandsKeeper = koin.commandsKeeper
log.d { "Subscribe to scopes changed flow" }
commandsKeeper.onScopeChanged.subscribeSafelyWithoutExceptions(scope) {

View File

@@ -0,0 +1,10 @@
package dev.inmo.plagubot.plugins.commands
import org.koin.core.Koin
import org.koin.core.scope.Scope
val Scope.commandsKeeper
get() = get<CommandsKeeper>()
val Koin.commandsKeeper
get() = get<CommandsKeeper>()