Merge: fix(gateway) add metadata param to _keep_typing and base send_typing
This commit is contained in:
commit
5fc751e543
2 changed files with 5 additions and 4 deletions
|
|
@ -413,11 +413,12 @@ class BasePlatformAdapter(ABC):
|
||||||
"""
|
"""
|
||||||
return SendResult(success=False, error="Not supported")
|
return SendResult(success=False, error="Not supported")
|
||||||
|
|
||||||
async def send_typing(self, chat_id: str) -> None:
|
async def send_typing(self, chat_id: str, metadata=None) -> None:
|
||||||
"""
|
"""
|
||||||
Send a typing indicator.
|
Send a typing indicator.
|
||||||
|
|
||||||
Override in subclasses if the platform supports it.
|
Override in subclasses if the platform supports it.
|
||||||
|
metadata: optional dict with platform-specific context (e.g. thread_id for Slack).
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -620,7 +621,7 @@ class BasePlatformAdapter(ABC):
|
||||||
|
|
||||||
return media, cleaned
|
return media, cleaned
|
||||||
|
|
||||||
async def _keep_typing(self, chat_id: str, interval: float = 2.0) -> None:
|
async def _keep_typing(self, chat_id: str, interval: float = 2.0, metadata=None) -> None:
|
||||||
"""
|
"""
|
||||||
Continuously send typing indicator until cancelled.
|
Continuously send typing indicator until cancelled.
|
||||||
|
|
||||||
|
|
@ -629,7 +630,7 @@ class BasePlatformAdapter(ABC):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
await self.send_typing(chat_id)
|
await self.send_typing(chat_id, metadata=metadata)
|
||||||
await asyncio.sleep(interval)
|
await asyncio.sleep(interval)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
pass # Normal cancellation when handler completes
|
pass # Normal cancellation when handler completes
|
||||||
|
|
|
||||||
|
|
@ -580,7 +580,7 @@ class SignalAdapter(BasePlatformAdapter):
|
||||||
return SendResult(success=True)
|
return SendResult(success=True)
|
||||||
return SendResult(success=False, error="RPC send failed")
|
return SendResult(success=False, error="RPC send failed")
|
||||||
|
|
||||||
async def send_typing(self, chat_id: str) -> None:
|
async def send_typing(self, chat_id: str, metadata=None) -> None:
|
||||||
"""Send a typing indicator."""
|
"""Send a typing indicator."""
|
||||||
params: Dict[str, Any] = {
|
params: Dict[str, Any] = {
|
||||||
"account": self.account,
|
"account": self.account,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue