fix(teams): fall back to flat send when threading returns 400

Group chats return 400 for threaded sends. Catch the error and
fall back to a flat send so messages always get delivered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Aamir Jawaid 2026-05-01 05:21:28 +00:00 committed by Teknium
parent 69aeba0df7
commit 3f023450dd

View file

@ -509,8 +509,11 @@ class TeamsAdapter(BasePlatformAdapter):
for chunk in chunks:
try:
if reply_to:
result = await self._app.reply(chat_id, reply_to, chunk)
if reply_to and reply_to.isdigit() and reply_to != "0":
try:
result = await self._app.reply(chat_id, reply_to, chunk)
except Exception:
result = await self._app.send(chat_id, chunk)
else:
result = await self._app.send(chat_id, chunk)
last_message_id = getattr(result, "id", None)