Refine backlog policy and runtime guards

Move speculative framework items into Ideas and bump rc.14

Guard tgapi API/uploader setup and nil plugin registrations

Add missing observer Event godoc
This commit is contained in:
2026-03-31 16:57:08 +03:00
parent a818174fbf
commit ba25dab6b1
8 changed files with 38 additions and 7 deletions
+13 -1
View File
@@ -18,7 +18,7 @@ const (
CommandValueStringType CommandValueType = "string"
// CommandValueIntType expects a decimal integer (digits only).
CommandValueIntType CommandValueType = "int"
// CommandValueBoolType is reserved for future use (not implemented).
// CommandValueBoolType expects a exact "true" or "false".
CommandValueBoolType CommandValueType = "bool"
// CommandValueAnyType accepts any input without validation.
CommandValueAnyType CommandValueType = "any"
@@ -193,6 +193,12 @@ func NewPlugin[T AppData](name string) *Plugin[T] {
// AddCommand registers a command in the plugin.
// The command's .command field is used as the key.
func (p *Plugin[T]) AddCommand(command *Command[T]) *Plugin[T] {
if command == nil {
if p.logger != nil {
p.logger.Warnln("trying to add nil command")
}
return p
}
p.commands[command.command] = command
return p
}
@@ -208,6 +214,12 @@ func (p *Plugin[T]) NewCommand(exec CommandExecutor[T], command string, args ...
// AddPayload registers a payload (e.g., callback query data) in the plugin.
// Payloads are triggered by inline button callback_data, not by message text.
func (p *Plugin[T]) AddPayload(command *Command[T]) *Plugin[T] {
if command == nil {
if p.logger != nil {
p.logger.Warnln("trying to add nil command")
}
return p
}
p.payloads[command.command] = command
return p
}