From 7c4c7ef3c7a0bdaa5102799a44f13bb5a52978eb Mon Sep 17 00:00:00 2001 From: krau <71133316+krau@users.noreply.github.com> Date: Tue, 25 Aug 2026 13:26:44 +0800 Subject: [PATCH] fix(bot): stopped swallowing callbacks on permission pass --- client/bot/handlers/middleware.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/bot/handlers/middleware.go b/client/bot/handlers/middleware.go index 2b98bb9..678db35 100644 --- a/client/bot/handlers/middleware.go +++ b/client/bot/handlers/middleware.go @@ -1,6 +1,8 @@ package handlers import ( + "errors" + "github.com/celestix/gotgproto/dispatcher" "github.com/celestix/gotgproto/ext" "github.com/duke-git/lancet/v2/slice" @@ -37,10 +39,12 @@ func checkPermission(ctx *ext.Context, update *ext.Update) error { } // withPermission wraps a callback handler with the same whitelist check used -// for message handlers (checkPermission). +// for message handlers (checkPermission). ContinueGroups is the dispatcher's +// success sentinel, not an error: only real failures and EndGroups stop the +// chain before the wrapped handler runs. func withPermission(handler func(*ext.Context, *ext.Update) error) func(*ext.Context, *ext.Update) error { return func(ctx *ext.Context, update *ext.Update) error { - if err := checkPermission(ctx, update); err != nil { + if err := checkPermission(ctx, update); err != nil && !errors.Is(err, dispatcher.ContinueGroups) { return err } return handler(ctx, update)