feat(channels): add threading support to message channels
Add optional thread_ts field to ChannelMessage and SendMessage for platform-specific threading (e.g. Slack threads, Discord threads). - ChannelMessage.thread_ts captures incoming thread context - SendMessage.thread_ts propagates thread context to replies - SendMessage::in_thread() builder for fluent API - Slack: send with thread_ts, capture ts from incoming messages - All reply paths in runtime preserve thread context via in_thread() - All other channels initialize thread_ts: None (forward-compatible) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
adc998429e
commit
9afe4f28e7
18 changed files with 63 additions and 8 deletions
|
|
@ -54,11 +54,15 @@ impl Channel for SlackChannel {
|
|||
}
|
||||
|
||||
async fn send(&self, message: &SendMessage) -> anyhow::Result<()> {
|
||||
let body = serde_json::json!({
|
||||
let mut body = serde_json::json!({
|
||||
"channel": message.recipient,
|
||||
"text": message.content
|
||||
});
|
||||
|
||||
if let Some(ref ts) = message.thread_ts {
|
||||
body["thread_ts"] = serde_json::json!(ts);
|
||||
}
|
||||
|
||||
let resp = self
|
||||
.http_client()
|
||||
.post("https://slack.com/api/chat.postMessage")
|
||||
|
|
@ -170,6 +174,7 @@ impl Channel for SlackChannel {
|
|||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_secs(),
|
||||
thread_ts: Some(ts.to_string()),
|
||||
};
|
||||
|
||||
if tx.send(channel_msg).await.is_err() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue