package channelbridge import ( "context" "fmt" "git.yeij.top/AskaEth/Cyrene_v2/internal/channel/adapter" ) // 本文件承载出站回复路径(design/16 §4.6 §5):循环产生的文本 // 通过接收该消息的同一账号适配器 // 送回来源会话。 // sendReply 把循环产生的文本送回渠道的来源会话, // 经由接收该消息的账号适配器(多账号安全, // design/16 §4.6 §5)。它照搬入站消息的渠道路由字段, // 使适配器解析出消息来自的同一对端,并经 // 共享的 IM 气泡派发器出口(剥离角色扮演/旁白 + 按
切分 + 0.5-2s 间隔)。 func (b *Bridge) sendReply(ctx context.Context, in adapter.UnifiedMessage, a adapter.PlatformAdapter, text string) error { if a == nil { a = b.adapter(in.Platform) } if a == nil { return fmt.Errorf("channelbridge: no adapter for platform %q", in.Platform) } return b.sendIMBubbles(ctx, in, func(ctx context.Context, msg adapter.UnifiedMessage) error { return a.SendMessage(ctx, adapter.UnifiedResponse{Messages: []adapter.UnifiedMessage{msg}}) }, text) }