From 42ff5262f508d0f98d70f6bd5e64b59c87a20370 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 9 Jul 2022 21:11:55 +0600 Subject: [PATCH] update readme --- README.md | 3 ++- src/main/kotlin/CommandsPlugin.kt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 619177f..390d42c 100644 --- a/README.md +++ b/README.md @@ -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) -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 diff --git a/src/main/kotlin/CommandsPlugin.kt b/src/main/kotlin/CommandsPlugin.kt index e0aed0a..e7f023c 100644 --- a/src/main/kotlin/CommandsPlugin.kt +++ b/src/main/kotlin/CommandsPlugin.kt @@ -7,6 +7,7 @@ import dev.inmo.plagubot.Plugin import dev.inmo.tgbotapi.extensions.api.bot.* import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext import dev.inmo.tgbotapi.types.BotCommand +import dev.inmo.tgbotapi.types.botCommandsLimit import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonObject import org.jetbrains.exposed.sql.Database @@ -34,7 +35,7 @@ class CommandsPlugin : Plugin { runCatchingSafely { commands ?.let { setMyCommands( - commands.distinctBy { it.command }, + commands.distinctBy { it.command }.take(botCommandsLimit.last + 1), key.scope, key.languageCode )