Repository navigation
Conversation
…method call' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa698b55ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .request<MethodsApiReturnType["sendRichMessage"]>( | ||
| "sendRichMessage", | ||
| toSnakeCase(params), |
There was a problem hiding this comment.
Serialize rich message media as multipart uploads
When sendRichMessage or sendRichMessageDraft is given a local file/Buffer in richMessage (for example, in a media block), this call passes it under the nested rich_message object. MediaData.hasMedia only recurses into arrays, not nested objects, and rich_message is not JSON-encoded for multipart requests, so the request is sent as JSON and the file cannot be uploaded.
Useful? React with 👍 / 👎.
| if (id === "media" && item.type === "live_photo") { | ||
| const photoSource = item.photo?.source ?? item; | ||
|
|
||
| if ( | ||
| !this.isMediaType(photoSource.media) && | ||
| !(await fileExists(photoSource.media)) |
There was a problem hiding this comment.
Attach the static live photo file
For a normal InputMediaLivePhoto, photo is a MediaDataParam, not an object containing source; consequently this expression falls back to the whole item, and the following upload reads photoSource.media (the video) instead of item.photo. Media-group live photos with locally uploaded files therefore attach the video for both media and photo, causing an invalid or incorrect live photo.
Useful? React with 👍 / 👎.
| return this.client.deleteEphemeralMessage({ | ||
| chatId: this.chat.id, | ||
| receiverUserId: this.author.id, | ||
| ephemeralMessageId: this.ephemeralMessageId, |
There was a problem hiding this comment.
Target the ephemeral message recipient
For an ephemeral message, author is the sender (from), while the new parser separately stores the API-required recipient as receiverUser. This sends the sender ID as receiver_user_id, so deleting or editing an outgoing ephemeral message normally targets the bot/sender rather than its recipient; the same mistake is repeated in all four ephemeral helper methods.
Useful? React with 👍 / 👎.
| deleteReaction(options = {}) { | ||
| return this.client.deleteMessageReaction({ | ||
| chatId: this.id, | ||
| messageId: this.id, | ||
| ...options, |
There was a problem hiding this comment.
Require a message ID when deleting reactions from a Chat
Chat.id is the chat identifier, not a message identifier, and this convenience method accepts no message ID. Thus a normal chat.deleteReaction() call sends the chat ID as message_id, which will fail or delete a reaction from an unrelated message if identifiers happen to coincide; expose a target message ID or remove this wrapper.
Useful? React with 👍 / 👎.
| PurchasedPaidMedia: "purchasedPaidMedia", | ||
| ManagedBotUpdated: "managedBotUpdated", | ||
| Subscription: "Subscription", | ||
| MessageGenerationStopped: "messageGenerationStopped", |
There was a problem hiding this comment.
Emit subscription updates using the lowercase event name
EventHandlers exposes the new event as subscription, but this constant is capitalized and WorkerClient emits it through Events.Subscription. Consequently listeners registered through the typed public API as client.on("subscription", ...) never run for subscription updates.
Useful? React with 👍 / 👎.
| data: NonNullable< | ||
| Update["message"] | Update["channel_post"] | Update["business_message"] | ||
| | Update["message"] | ||
| | Update["channel_post"] | ||
| | Update["business_message"] | ||
| | Update["guest_message"] |
There was a problem hiding this comment.
Dispatch guest messages to the guest handler
Adding guest_message to the handler argument type does not make it reachable: processUpdate only enters its message branch for message, channel_post, and business_message, so an update containing only guest_message falls through. Moreover, Events.GuestMessage is mapped to message, so the newly declared guestMessage listener can never receive the guest query.
Useful? React with 👍 / 👎.
| sendRichDraft(richMessage, draftId) { | ||
| return this.client.sendRichMessageDraft({ | ||
| richMessage, | ||
| draftId, | ||
| chatId: this.chat.id, |
There was a problem hiding this comment.
Reuse the stopped draft ID for rich drafts
MessageGenerationStopped already stores the stopped draft in this.draftId, and sendDraft correctly reuses it, but this equivalent helper requires an unrelated second argument. Calling event.sendRichDraft(richMessage) therefore sends an undefined draft_id and Telegram rejects the request; it should use the stored ID (and, if desired, accept options instead).
Useful? React with 👍 / 👎.
4.15.0 - (2026-10-03)
Updates
10.0,10.1,10.2,10.3cbfe29e, 000a3eb, 2b22972, 5f107f6