From ced0a2d067c21009473505341c887035d715315e Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 18 Dec 2025 16:36:23 +0200 Subject: [PATCH] gotd: don't emit duplicate updates for channels --- pkg/gotd/telegram/updates/state_apply.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/gotd/telegram/updates/state_apply.go b/pkg/gotd/telegram/updates/state_apply.go index ebea3f60..e1690dc0 100644 --- a/pkg/gotd/telegram/updates/state_apply.go +++ b/pkg/gotd/telegram/updates/state_apply.go @@ -45,6 +45,7 @@ func (s *internalState) applyCombined(ctx context.Context, comb *tg.UpdatesCombi ) sortUpdatesByPts(comb.Updates) + nonChannelUpdates := comb.Updates[:0] for _, u := range comb.Updates { switch u := u.(type) { case *tg.UpdatePtsChanged: @@ -86,6 +87,8 @@ func (s *internalState) applyCombined(ctx context.Context, comb *tg.UpdatesCombi }); err != nil { return false, err } + } else { + nonChannelUpdates = append(nonChannelUpdates, u) } if qts, ok := tg.IsQtsUpdate(u); ok { @@ -96,7 +99,7 @@ func (s *internalState) applyCombined(ctx context.Context, comb *tg.UpdatesCombi } if err := s.handler.Handle(ctx, &tg.Updates{ - Updates: comb.Updates, + Updates: nonChannelUpdates, Users: ents.Users, Chats: ents.Chats, }); err != nil {