mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-08-04 01:19:36 +00:00
Merge pull request #3135 from ZOOWH/fix/3110-telegram-forum-thread-id
fix(telegram): use compositeChatID in InboundContext.ChatID for forum topics
This commit is contained in:
@@ -1185,7 +1185,7 @@ func (c *TelegramChannel) handleMessages(ctx context.Context, messages []*telego
|
||||
|
||||
inboundCtx := bus.InboundContext{
|
||||
Channel: c.Name(),
|
||||
ChatID: fmt.Sprintf("%d", chatID),
|
||||
ChatID: compositeChatID,
|
||||
ChatType: peerKind,
|
||||
SenderID: platformID,
|
||||
MessageID: messageID,
|
||||
|
||||
@@ -1212,8 +1212,9 @@ func TestHandleMessage_ForumTopic_SetsMetadata(t *testing.T) {
|
||||
inbound, ok := <-messageBus.InboundChan()
|
||||
require.True(t, ok, "expected inbound message")
|
||||
|
||||
// ChatID remains the parent chat; TopicID isolates the sub-conversation.
|
||||
assert.Equal(t, "-1001234567890", inbound.ChatID)
|
||||
// ChatID includes the thread ID for forum topics so outbound
|
||||
// delivery resolves the correct topic without relying solely on TopicID fallback.
|
||||
assert.Equal(t, "-1001234567890/42", inbound.ChatID)
|
||||
assert.Equal(t, "group", inbound.Context.ChatType)
|
||||
assert.Equal(t, "42", inbound.Context.TopicID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user