mirror of
https://github.com/InsanusMokrassar/PlaguBotCommandsPlugin.git
synced 2025-10-14 20:00:02 +00:00
fill README
This commit is contained in:
@@ -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) {
|
||||
|
10
src/main/kotlin/KoinCommandKeeperGetters.kt
Normal file
10
src/main/kotlin/KoinCommandKeeperGetters.kt
Normal 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>()
|
Reference in New Issue
Block a user