fix: narrow rich capability error detection to prevent false latch

- Remove overly broad 'not found' match that could trigger on transient
  errors like 'chat not found' or 'message to reply not found'
- Keep only 'method not found' and 'unknown method' which indicate
  the server genuinely doesn't support sendRichMessage
- Demote timeout log from warning to debug since it falls back to
  legacy path successfully
This commit is contained in:
NanoBot
2026-06-21 15:22:05 +08:00
committed by Xubin Ren
parent e9494c1dce
commit a8c65b50ca
+2 -3
View File
@@ -639,9 +639,8 @@ class TelegramChannel(BaseChannel):
err = str(exc).lower() err = str(exc).lower()
return ( return (
"method not found" in err "method not found" in err
or "not found" in err
or "bad request: invalid parameter" in err
or "unknown method" in err or "unknown method" in err
or "bad request: invalid parameter" in err
) )
async def _try_send_rich( async def _try_send_rich(
@@ -694,7 +693,7 @@ class TelegramChannel(BaseChannel):
err_str = str(exc).lower() err_str = str(exc).lower()
is_timeout = "timed out" in err_str or isinstance(exc, TimedOut) is_timeout = "timed out" in err_str or isinstance(exc, TimedOut)
if is_timeout: if is_timeout:
self.logger.warning("sendRichMessage timeout, not retrying legacy") self.logger.debug("sendRichMessage timeout, falling back to legacy path")
return False return False
self.logger.debug("sendRichMessage failed: {}", exc) self.logger.debug("sendRichMessage failed: {}", exc)
return False return False