mirror of
https://github.com/InsanusMokrassar/PlaguBotCommandsPlugin.git
synced 2024-11-23 16:28:43 +00:00
update readme
This commit is contained in:
parent
a2345fe496
commit
42ff5262f5
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/plagubot.plugins.commands/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/plagubot.plugins.commands)
|
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/plagubot.plugins.commands/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/plagubot.plugins.commands)
|
||||||
|
|
||||||
This plugin has been created for centralized work with commands in your plugins.
|
This plugin has been created for centralized work with commands in your plugins. You may pass your commands (even in
|
||||||
|
runtime) and they will automatically appear in bot commands for users
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import dev.inmo.plagubot.Plugin
|
|||||||
import dev.inmo.tgbotapi.extensions.api.bot.*
|
import dev.inmo.tgbotapi.extensions.api.bot.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
import dev.inmo.tgbotapi.types.BotCommand
|
import dev.inmo.tgbotapi.types.BotCommand
|
||||||
|
import dev.inmo.tgbotapi.types.botCommandsLimit
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.JsonObject
|
import kotlinx.serialization.json.JsonObject
|
||||||
import org.jetbrains.exposed.sql.Database
|
import org.jetbrains.exposed.sql.Database
|
||||||
@ -34,7 +35,7 @@ class CommandsPlugin : Plugin {
|
|||||||
runCatchingSafely {
|
runCatchingSafely {
|
||||||
commands ?.let {
|
commands ?.let {
|
||||||
setMyCommands(
|
setMyCommands(
|
||||||
commands.distinctBy { it.command },
|
commands.distinctBy { it.command }.take(botCommandsLimit.last + 1),
|
||||||
key.scope,
|
key.scope,
|
||||||
key.languageCode
|
key.languageCode
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user