From 746847cf611861f924bfe3e98e421f96a872599f Mon Sep 17 00:00:00 2001 From: ScuroNeko Date: Wed, 18 Feb 2026 11:39:27 +0300 Subject: [PATCH] l10n and bot command auto generation; v0.6.0 --- cmd_generator.go | 3 +++ plugins.go | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd_generator.go b/cmd_generator.go index 083b14b..7d67a2c 100644 --- a/cmd_generator.go +++ b/cmd_generator.go @@ -27,6 +27,9 @@ func generateBotCommand(cmd Command) tgapi.BotCommand { func generateBotCommandForPlugin(pl Plugin) []tgapi.BotCommand { commands := make([]tgapi.BotCommand, 0) for _, cmd := range pl.Commands { + if cmd.skipAutoCmd { + continue + } commands = append(commands, generateBotCommand(cmd)) } return commands diff --git a/plugins.go b/plugins.go index cecd014..e8ae2df 100644 --- a/plugins.go +++ b/plugins.go @@ -52,10 +52,11 @@ type Command struct { exec CommandExecutor args extypes.Slice[CommandArg] middlewares extypes.Slice[Middleware] + skipAutoCmd bool } func NewCommand(exec CommandExecutor, command string, args ...CommandArg) *Command { - return &Command{command, "", exec, args, make(extypes.Slice[Middleware], 0)} + return &Command{command, "", exec, args, make(extypes.Slice[Middleware], 0), false} } func (c *Command) Use(m Middleware) *Command { c.middlewares = c.middlewares.Push(m) @@ -65,6 +66,10 @@ func (c *Command) SetDescription(desc string) *Command { c.description = desc return c } +func (c *Command) SkipCommandAutoGen() *Command { + c.skipAutoCmd = true + return c +} func (c *Command) validateArgs(args []string) error { cmdArgs := c.args.Filter(func(e CommandArg) bool { return !e.required }) if len(args) < cmdArgs.Len() {