(new): rich message support
Golang lint / lint (pull_request) Successful in 1m20s
Golang lint / lint (push) Successful in 4m8s

(fix): runtime reliability
(tests): regression coverage
(doc): v1.1 release notes
This commit is contained in:
2026-08-12 16:34:44 +03:00
parent 48ddf66540
commit f03a081ed6
83 changed files with 6122 additions and 1925 deletions
+12 -1
View File
@@ -93,6 +93,7 @@ type Command[T AppData] struct {
args extypes.Slice[CommandArg] // List of expected arguments
middlewares extypes.Slice[Middleware[T]] // Optional middleware chain
skipAutoCmd bool // If true, this command won't be auto-added to help menus
isEphemeral bool
}
// NewCommand creates a new Command with the given identifier, executor, and arguments.
@@ -108,7 +109,9 @@ type Command[T AppData] struct {
// that fit Telegram's callback_data limit, though the configured payload
// encoding may impose its own restrictions.
func NewCommand[T any](command string, exec CommandExecutor[T], args ...CommandArg) *Command[T] {
return &Command[T]{command, "", exec, args, make(extypes.Slice[Middleware[T]], 0), false}
return &Command[T]{
command, "", exec, args, make(extypes.Slice[Middleware[T]], 0), false, false,
}
}
// Use adds a middleware to the command's execution chain.
@@ -130,6 +133,14 @@ func (c *Command[T]) SkipCommandAutoGen() *Command[T] {
return c
}
// SetEphemeral controls whether Telegram treats the command as ephemeral.
//
// Since: Bot API 10.2
func (c *Command[T]) SetEphemeral(b bool) *Command[T] {
c.isEphemeral = b
return c
}
func (c *Command[T]) validateArgs(args []string) error {
for i := range c.args.Len() {
if i >= len(args) && c.args.Get(i).required {