Merge: fix(gateway) add metadata param to _keep_typing and base send_typing

This commit is contained in:
teknium1 2026-03-10 15:08:45 -07:00
commit 5fc751e543
2 changed files with 5 additions and 4 deletions

View file

@ -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

View file

@ -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,