feat(discord): persistent typing indicator for DMs
Based on PR #2427 by @oxngon (core feature extracted, reformatting and unrelated changes dropped). Discord's TYPING_START gateway event is unreliable for bot DMs. This adds a background typing loop that hits POST /channels/{id}/typing every 8 seconds (indicator lasts ~10s) until the response is sent. - send_typing() starts a per-channel background loop (idempotent) - stop_typing() cancels it (called after _run_agent returns) - Base adapter gets stop_typing() as a no-op default - Per-channel tracking via _typing_tasks dict prevents duplicates
This commit is contained in:
parent
ffa8b562e9
commit
ab3cbfc99d
3 changed files with 68 additions and 8 deletions
|
|
@ -504,6 +504,14 @@ class BasePlatformAdapter(ABC):
|
|||
metadata: optional dict with platform-specific context (e.g. thread_id for Slack).
|
||||
"""
|
||||
pass
|
||||
|
||||
async def stop_typing(self, chat_id: str) -> None:
|
||||
"""Stop a persistent typing indicator (if the platform uses one).
|
||||
|
||||
Override in subclasses that start background typing loops.
|
||||
Default is a no-op for platforms with one-shot typing indicators.
|
||||
"""
|
||||
pass
|
||||
|
||||
async def send_image(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue