Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
316e29f208
commit
052b8f1b0a
1 changed files with 13 additions and 7 deletions
|
|
@ -198,6 +198,8 @@ func (c *DingTalkChannel) onChatBotMessageReceived(
|
|||
}
|
||||
|
||||
// Try to create and deliver card (optional feature)
|
||||
// Only attempt this if a card template is configured; otherwise, fall back silently
|
||||
if c.config.CardTemplateID != "" {
|
||||
// If it fails, log the error but continue with normal message handling
|
||||
if cardID, err := c.tryCardCreateAndDeliver(ctx, data); err != nil {
|
||||
logger.WarnC("dingtalk", "Failed to create or deliver card, falling back to direct reply")
|
||||
|
|
@ -207,6 +209,10 @@ func (c *DingTalkChannel) onChatBotMessageReceived(
|
|||
chatID = data.MsgId
|
||||
c.cardInstanceIDs.Store(chatID, cardID)
|
||||
}
|
||||
} else {
|
||||
// Card feature not configured; just store the session webhook for direct replies
|
||||
c.sessionWebhooks.Store(chatID, data.SessionWebhook)
|
||||
}
|
||||
|
||||
// Handle the message through the base channel
|
||||
c.HandleMessage(ctx, peer, "", senderID, chatID, content, nil, metadata, sender)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue