From d500d84de60a69a9527dadf269952ba4bddfdb3d Mon Sep 17 00:00:00 2001 From: surdeus Date: Tue, 12 Sep 2023 11:41:50 +0300 Subject: [PATCH] Fixed some CommandWidget bugs related to transmitting unneeded updates further. --- tg/action.go | 2 +- tg/command.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tg/action.go b/tg/action.go index bc67b26..829744d 100644 --- a/tg/action.go +++ b/tg/action.go @@ -23,7 +23,7 @@ func newAction(a Action) *action { } func (a *action) Act(c *Context) { - if a.Action != nil { + if a != nil && a.Action != nil { a.Action.Act(c) } } diff --git a/tg/command.go b/tg/command.go index 3d573b5..1ba5ce1 100644 --- a/tg/command.go +++ b/tg/command.go @@ -171,7 +171,8 @@ func (widget *CommandWidget) Serve(c *Context, updates chan *Update) error { if !ok { c.Run(widget.Usage, u) continue - } + } + c.Run(cmd.Action, u) if cmd.Widget != nil { if cmdUpdates != nil { @@ -187,6 +188,7 @@ func (widget *CommandWidget) Serve(c *Context, updates chan *Update) error { cmdUpdates = nil }() } + continue } if cmdUpdates != nil {