feat(telegram): add typing indicator when receiving messages

- Send 'typing' chat action immediately upon receiving a message
- Improves user experience by showing the bot is processing
- Telegram displays '...is typing' indicator while the AI generates response
- Gracefully ignores errors to avoid breaking message handling

Previously, there was no typing indicator implementation, causing
users to wait without feedback during AI response generation.
This commit is contained in:
junbaor 2026-02-16 04:02:36 +08:00 committed by GitHub
parent a3c66e3383
commit 3b7a140aad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -500,6 +500,17 @@ Allowlist Telegram @username or numeric user ID, then run `zeroclaw onboard --ch
.map(|id| id.to_string())
.unwrap_or_default();
// Send "typing" indicator immediately when we receive a message
let typing_body = serde_json::json!({
"chat_id": &chat_id,
"action": "typing"
});
let _ = self.client
.post(self.api_url("sendChatAction"))
.json(&typing_body)
.send()
.await; // Ignore errors for typing indicator
let msg = ChannelMessage {
id: Uuid::new_v4().to_string(),
sender: chat_id,