fix: skip empty/whitespace text in Telegram send to prevent 400 errors

Telegram API returns HTTP 400 when sent whitespace-only or empty
text. Add a guard at the top of send() to silently succeed on
blank content instead of crashing.

Equivalent to OpenClaw #56620.
This commit is contained in:
SHL0MS
2026-03-31 12:07:28 -04:00
committed by Teknium
parent f4d44c777b
commit 83dec2b3ec

View File

@@ -742,6 +742,10 @@ class TelegramAdapter(BasePlatformAdapter):
if not self._bot:
return SendResult(success=False, error="Not connected")
# Skip whitespace-only text to prevent Telegram 400 empty-text errors.
if not content or not content.strip():
return SendResult(success=True, message_id=None)
try:
# Format and split message if needed
formatted = self.format_message(content)