Typing Indicators 输入指示
Typing Indicators 显示用户正在输入的状态。
功能特性
1. 输入状态跟踪
typescript
interface TypingIndicator {
user_id: string;
channel: string;
is_typing: boolean;
started_at: Date;
}2. 发送输入状态
typescript
// 通知对方我正在输入
await agent.typing.send({
chat_id: '123456',
is_typing: true
});
// 停止输入
await agent.typing.send({
chat_id: '123456',
is_typing: false
});3. 监听输入状态
typescript
agent.typing.on('user_started_typing', (userId) => {
console.log(`User ${userId} started typing`);
});
agent.typing.on('user_stopped_typing', (userId) => {
console.log(`User ${userId} stopped typing`);
});通道支持
| 通道 | 显示输入 | 可发送 |
|---|---|---|
| ✅ | ❌ | |
| Telegram | ✅ | ✅ |
| Discord | ✅ | ✅ |
| Slack | ✅ | ✅ |
配置选项
yaml
typing:
indicators:
send: true # 发送我的输入状态
show: true # 显示他人输入状态
timeout: 5000 # 输入状态超时(毫秒)
debounce: 1000 # 发送间隔(毫秒)相关概念
- 消息 (Messages) - 消息处理
- 在线状态 (Presence) - 在线状态