From af630ecbd172a064371cbc8942d76d344723f93b Mon Sep 17 00:00:00 2001 From: Adam Van Ymeren Date: Fri, 27 Jun 2025 20:20:53 -0700 Subject: [PATCH] updates: don't die when deleting a message we don't have in db, just log and ignore --- .pre-commit-config.yaml | 3 ++- pkg/connector/telegram.go | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9507a7b..8adbcdb6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,8 @@ repos: - "go.mau.fi/mautrix-telegram" - "-w" - id: go-vet-mod - - id: go-staticcheck-repo-mod +# Disabled for now until we can find a way to filter out the gotd package +# - id: go-staticcheck-repo-mod - id: go-mod-tidy - repo: https://github.com/beeper/pre-commit-go diff --git a/pkg/connector/telegram.go b/pkg/connector/telegram.go index 9ed7b1c4..598e1abd 100644 --- a/pkg/connector/telegram.go +++ b/pkg/connector/telegram.go @@ -697,7 +697,11 @@ func (t *TelegramClient) onDeleteMessages(ctx context.Context, channelID int64, return err } if len(parts) == 0 { - return fmt.Errorf("no parts found for message %d", messageID) + zerolog.Ctx(ctx).Debug(). + Int("message_id", messageID). + Int64("channel_id", channelID). + Msg("ignoring delete of message we have no parts for") + continue } // TODO can deletes happen across rooms? portalKey = parts[0].Room