fix telegram not response

This commit is contained in:
czyt 2026-02-13 13:56:23 +08:00
parent 42e0e588dd
commit 9edfe98ba1

View file

@ -359,7 +359,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, update telego.Updat
"is_group": fmt.Sprintf("%t", message.Chat.Type != "private"), "is_group": fmt.Sprintf("%t", message.Chat.Type != "private"),
} }
c.HandleMessage(fmt.Sprintf("%d", user.ID), fmt.Sprintf("%d", chatID), content, mediaPaths, metadata) c.HandleMessage(senderID, fmt.Sprintf("%d", chatID), content, mediaPaths, metadata)
} }
func (c *TelegramChannel) downloadPhoto(ctx context.Context, fileID string) string { func (c *TelegramChannel) downloadPhoto(ctx context.Context, fileID string) string {
@ -470,8 +470,11 @@ func extractCodeBlocks(text string) codeBlockMatch {
codes = append(codes, match[1]) codes = append(codes, match[1])
} }
idx := 0
text = re.ReplaceAllStringFunc(text, func(m string) string { text = re.ReplaceAllStringFunc(text, func(m string) string {
return fmt.Sprintf("\x00CB%d\x00", len(codes)-1) s := fmt.Sprintf("\x00CB%d\x00", idx)
idx++
return s
}) })
return codeBlockMatch{text: text, codes: codes} return codeBlockMatch{text: text, codes: codes}
@ -491,8 +494,11 @@ func extractInlineCodes(text string) inlineCodeMatch {
codes = append(codes, match[1]) codes = append(codes, match[1])
} }
idx := 0
text = re.ReplaceAllStringFunc(text, func(m string) string { text = re.ReplaceAllStringFunc(text, func(m string) string {
return fmt.Sprintf("\x00IC%d\x00", len(codes)-1) s := fmt.Sprintf("\x00IC%d\x00", idx)
idx++
return s
}) })
return inlineCodeMatch{text: text, codes: codes} return inlineCodeMatch{text: text, codes: codes}