feat(discord): support referenced/quoted messages in replies
When a user replies to a message in Discord, the bot now reads m.ReferencedMessage and prepends its content to the incoming message as '[quoted message from Username]: content'. This gives the LLM full context of what message the user is replying to, enabling meaningful follow-up conversations.
This commit is contained in:
parent
bea238c337
commit
465819e1c6
1 changed files with 9 additions and 0 deletions
|
|
@ -338,6 +338,15 @@ func (c *DiscordChannel) handleMessage(s *discordgo.Session, m *discordgo.Messag
|
|||
content = c.stripBotMention(content)
|
||||
}
|
||||
|
||||
// Prepend referenced (quoted) message content if this is a reply
|
||||
if m.MessageReference != nil && m.ReferencedMessage != nil {
|
||||
refContent := m.ReferencedMessage.Content
|
||||
if refContent != "" {
|
||||
content = fmt.Sprintf("[quoted message from %s]: %s\n\n%s",
|
||||
m.ReferencedMessage.Author.Username, refContent, content)
|
||||
}
|
||||
}
|
||||
|
||||
senderID := m.Author.ID
|
||||
|
||||
mediaPaths := make([]string, 0, len(m.Attachments))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue