Skip to content

Commit 5740c2b

Browse files
Dan Millsclaude
andcommitted
feat: capture Discord attachment metadata in inbox messages
Add support for Discord message attachments (screenshots, images, files) by extracting metadata into InboxMessage.Extra["attachments"]. Each attachment includes id, url, filename, size, content_type, width, and height fields. This enables future support for processing images and files shared via Discord, such as analyzing screenshots or reading document attachments. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a60a49f commit 5740c2b

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

internal/senses/discord.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,30 @@ func (d *DiscordSense) handleMessage(s *discordgo.Session, m *discordgo.MessageC
141141
extra["reply_to"] = fmt.Sprintf("discord-%s-%s", m.MessageReference.ChannelID, m.MessageReference.MessageID)
142142
}
143143

144+
// Capture attachments (screenshots, images, etc.)
145+
if len(m.Attachments) > 0 {
146+
attachments := make([]map[string]any, 0, len(m.Attachments))
147+
for _, att := range m.Attachments {
148+
attData := map[string]any{
149+
"id": att.ID,
150+
"url": att.URL,
151+
"filename": att.Filename,
152+
"size": att.Size,
153+
}
154+
if att.ContentType != "" {
155+
attData["content_type"] = att.ContentType
156+
}
157+
if att.Width > 0 {
158+
attData["width"] = att.Width
159+
}
160+
if att.Height > 0 {
161+
attData["height"] = att.Height
162+
}
163+
attachments = append(attachments, attData)
164+
}
165+
extra["attachments"] = attachments
166+
}
167+
144168
// Create inbox message
145169
msg := &memory.InboxMessage{
146170
ID: fmt.Sprintf("discord-%s-%s", m.ChannelID, m.ID),

0 commit comments

Comments
 (0)