Repository navigation
Conversation
…e audit log Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mysubcult
added a commit
to mysubcult/telegram
that referenced
this pull request
Oct 26, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One HTTP client for every Bot API call the extension makes (
Longman\TelegramBot\Request::setClient, installed inrun()):429 Too Many Requests— Telegram allows a bot about 20 messages a minute in one group, so a burst of chats in the operators group can hit it. Telegram says how long to wait (parameters.retry_after); waits up to 10 seconds are honoured and the call is sent again (at most twice). Longer waits are not slept through — the call fails as before. A call is repeated only when its body can be read again (files are seekable streams), so file uploads are retried too.400/403/429answer is only seen by the caller, and most callers just return. Now every 4xx/5xx goes to the audit log (System → Audit log, categorytelegram_api_error) asmethod: code description. The bot token (part of the URL) is never logged. Expected answers such asmessage is not modifiedare skipped.Nothing changes for successful calls; base URI and timeouts are the same as the client Longman creates by default.
How
providers/TelegramApiClient.php: GuzzleHandlerStack::create()plus two middlewares —Middleware::retry(decider readsretry_afterfrom the 429 body, delay = that wait) and a logging middleware. Both sit insidehttp_errors, so they see the 4xx as a response; callers still get the same exception/response as before.Tested
retry_after: 1) → waited 1 s → 200; 429 withretry_after: 60→ no retry, fails at once; 400 → logged, same exception as before.getMe, replies, file upload; a send to a missing topic is logged assendMessage: 400 Bad Request: message thread not found.🤖 Generated with Claude Code