Skip to content

Commit 86221d4

Browse files
authored
Merge pull request #3135 from ZOOWH/fix/3110-telegram-forum-thread-id
fix(telegram): use compositeChatID in InboundContext.ChatID for forum topics
2 parents e720be0 + 7019143 commit 86221d4

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

pkg/channels/telegram/telegram.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ func (c *TelegramChannel) handleMessages(ctx context.Context, messages []*telego
11851185

11861186
inboundCtx := bus.InboundContext{
11871187
Channel: c.Name(),
1188-
ChatID: fmt.Sprintf("%d", chatID),
1188+
ChatID: compositeChatID,
11891189
ChatType: peerKind,
11901190
SenderID: platformID,
11911191
MessageID: messageID,

pkg/channels/telegram/telegram_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,8 +1212,9 @@ func TestHandleMessage_ForumTopic_SetsMetadata(t *testing.T) {
12121212
inbound, ok := <-messageBus.InboundChan()
12131213
require.True(t, ok, "expected inbound message")
12141214

1215-
// ChatID remains the parent chat; TopicID isolates the sub-conversation.
1216-
assert.Equal(t, "-1001234567890", inbound.ChatID)
1215+
// ChatID includes the thread ID for forum topics so outbound
1216+
// delivery resolves the correct topic without relying solely on TopicID fallback.
1217+
assert.Equal(t, "-1001234567890/42", inbound.ChatID)
12171218
assert.Equal(t, "group", inbound.Context.ChatType)
12181219
assert.Equal(t, "42", inbound.Context.TopicID)
12191220
}

0 commit comments

Comments
 (0)