From 17eeb35da6e07a529dc1636c5e010a9692d4a01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E9=94=8B0668000834?= Date: Fri, 13 Mar 2026 09:17:35 +0800 Subject: [PATCH] feat(discord): include channel name in message metadata Add Discord channel name to metadata map when processing messages. This provides better context for the agent by including the human-readable channel name alongside the numeric channel ID. The channel name is retrieved from Discord's state cache (zero-cost lookup in common case) with graceful handling if not available. Fixes #1451 --- pkg/channels/discord/discord.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/channels/discord/discord.go b/pkg/channels/discord/discord.go index 83a04907c..838099dc4 100644 --- a/pkg/channels/discord/discord.go +++ b/pkg/channels/discord/discord.go @@ -451,12 +451,19 @@ func (c *DiscordChannel) handleMessage(s *discordgo.Session, m *discordgo.Messag peer := bus.Peer{Kind: peerKind, ID: peerID} + // Get channel name from Discord state (with API fallback on cache miss) + channelName := "" + if channel, err := c.session.State.Channel(m.ChannelID); err == nil && channel != nil { + channelName = channel.Name + } + metadata := map[string]string{ "user_id": senderID, "username": m.Author.Username, "display_name": sender.DisplayName, "guild_id": m.GuildID, "channel_id": m.ChannelID, + "channel_name": channelName, "is_dm": fmt.Sprintf("%t", m.GuildID == ""), }