Skip to content

Beta#123

Merged
5hojib merged 7 commits intomainfrom
beta
Apr 4, 2026
Merged

Beta#123
5hojib merged 7 commits intomainfrom
beta

Conversation

@5hojib
Copy link
Copy Markdown
Member

@5hojib 5hojib commented Apr 2, 2026

Summary by Sourcery

Update to Telegram API layer 224 and extend client features accordingly.

New Features:

  • Support live photos and associated video documents in input and message media types.
  • Enhance polls with open answers, answer/media metadata, attached media, unread vote tracking, and richer poll result structures.
  • Introduce AI-assisted message composition and diff entities for representing edits in formatted text.
  • Add story music support and richer poll-related reply, dialog, and notification fields, including poll-specific unread counts and filters.
  • Provide new bot management APIs for creating bots, managing bot tokens, web view buttons, and managed bots.
  • Expose URL auth enhancements including app verification metadata and app-specific flags.
  • Extend messages API with read metrics, music listening reports, poll answer management, and tone-aware translation/summarization options.
  • Add support in high-level send/copy message helpers for repeated scheduling, paid stars, message effects, quick replies, send-as, background sending, draft clearing, sticker set order updates, and suggested posts.

Enhancements:

  • Augment user and userFull types with additional bot management capabilities and security risk flags.
  • Extend reactions notification settings to cover poll vote notifications.
  • Include new message entities for representing insert/replace/delete diffs in text content.
  • Wire message_effect_id through message copy helpers to preserve or apply visual effects on copied messages.
  • Update stories send/edit methods to handle optional music documents on stories.

Documentation:

  • Expand Python method docstrings for send_cached_media and copy_message with descriptions of new sending options.
  • Update project and documentation configuration URLs to point to the new GitHub organization/repository.

Chores:

  • Bump Telegram schema comment from layer 223 to layer 224 and refresh lockfile metadata.

5hojib and others added 7 commits March 10, 2026 18:38
Signed-off-by: 5hojib <yesiamshojib@gmail.com>
This commit adds support for missing parameters in `copy_message` and
`send_cached_media` methods, specifically addressing the
`schedule_repeat_period` parameter which was causing a `TypeError`.

Changes:
- Added `schedule_repeat_period`, `allow_paid_stars`, `message_effect_id`,
  `quick_reply_shortcut`, `send_as`, `background`, `clear_draft`,
  `update_stickersets_order`, and `suggested_post` to
  `SendCachedMedia.send_cached_media`.
- Added the same parameters to `CopyMessage.copy_message` and
  `Message.copy`.
- Updated `Message.copy` and `CopyMessage.copy_message` to pass these
  parameters down the call chain.
- Updated the underlying `raw.functions.messages.SendMedia` call in
  `send_cached_media` to include these parameters.
- Fixed redundant media assignments in `send_cached_media`.
- Updated `invert_media` parameter to be optional (bool | None) for
  consistency.
- Added type narrowing for `send_as` in `send_cached_media` to ensure it
  only resolves if a value is provided.
Signed-off-by: 5hojib <yesiamshojib@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: 5hojib <yesiamshojib@gmail.com>
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 2, 2026

Reviewer's Guide

Updates Telegram Layer schema to 224 with new poll/media/bot/story capabilities and notification fields, extends Pyrogram high-level messaging APIs to expose new SendMedia options (scheduled repeats, paid stars, message effects, quick replies, send-as, background, drafts, suggested posts), updates project repository URLs, and ensures message copy helpers propagate the new message_effect_id parameter.

Sequence diagram for send_cached_media and copy_message with extended SendMedia options

sequenceDiagram
actor App
participant Client as PyrogramClient
participant Utils
participant SuggestedPost
participant Telegram as TelegramAPI

App->>Client: send_cached_media(chat_id,file_id,... schedule_repeat_period,allow_paid_stars,message_effect_id,quick_reply_shortcut,send_as,background,clear_draft,update_stickersets_order,suggested_post)
Client->>Utils: get_input_peer(chat_id)
Utils-->>Client: InputPeer
Client->>Utils: get_input_media_from_file_id(file_id)
Utils-->>Client: InputMedia
Client->>Utils: get_input_quick_reply_shortcut(quick_reply_shortcut)
Utils-->>Client: InputQuickReplyShortcut
Client->>SuggestedPost: write()
SuggestedPost-->>Client: InputSuggestedPost
Client->>Utils: resolve_peer(send_as)
Utils-->>Client: InputPeer (send_as)
Client->>Telegram: messages.SendMedia(peer,media,reply_to_msg_id,reply_markup,\n  noforwards,allow_paid_floodskip,invert_media,effect,background,\n  clear_draft,update_stickersets_order,schedule_date,schedule_repeat_period,\n  quick_reply_shortcut,send_as,allow_paid_stars,suggested_post)
Telegram-->>Client: Updates
Client-->>App: Message

App->>Client: copy_message(chat_id,from_chat_id,message_id,... new options)
Client->>Client: internally calls send_cached_media(...)\nwith same extended parameters
Client-->>App: Message
Loading

Class diagram for updated poll-related TL types (Layer 224)

classDiagram
class Poll {
  +long id
  +bool closed
  +bool public_voters
  +bool multiple_choice
  +bool quiz
  +bool open_answers
  +bool revoting_disabled
  +bool shuffle_answers
  +bool hide_results_until_close
  +bool creator
  +TextWithEntities question
  +Vector~PollAnswer~ answers
  +int close_period
  +int close_date
  +long hash
}

class PollAnswer {
  +TextWithEntities text
  +bytes option
  +MessageMedia media
  +Peer added_by
  +int date
}

class InputPollAnswer {
  +TextWithEntities text
  +InputMedia media
}

class PollAnswerVoters {
  +bytes option
  +bool chosen
  +bool correct
  +int voters
  +Vector~Peer~ recent_voters
}

class PollResults {
  +bool min
  +bool has_unread_votes
  +Vector~PollAnswerVoters~ results
  +int total_voters
  +Vector~Peer~ recent_voters
  +string solution
  +Vector~MessageEntity~ solution_entities
  +MessageMedia solution_media
}

class InputMediaPoll {
  +Poll poll
  +Vector~int~ correct_answers
  +InputMedia attached_media
  +string solution
  +Vector~MessageEntity~ solution_entities
  +InputMedia solution_media
}

class MessageMediaPoll {
  +Poll poll
  +PollResults results
  +MessageMedia attached_media
}

class MessageReplyHeader {
  +int reply_to_msg_id
  +Peer reply_to_peer_id
  +MessageFwdHeader reply_from
  +MessageMedia reply_media
  +int reply_to_top_id
  +string quote_text
  +Vector~MessageEntity~ quote_entities
  +int quote_offset
  +int todo_item_id
  +bytes poll_option
}

class InputReplyToMessage {
  +int reply_to_msg_id
  +int top_msg_id
  +InputPeer reply_to_peer_id
  +string quote_text
  +Vector~MessageEntity~ quote_entities
  +int quote_offset
  +InputPeer monoforum_peer_id
  +int todo_item_id
  +bytes poll_option
}

class UpdateMessagePoll {
  +Peer peer
  +int msg_id
  +int top_msg_id
  +long poll_id
  +Poll poll
  +PollResults results
}

class UpdateMessagePollVote {
  +long poll_id
  +Peer peer
  +Vector~bytes~ options
  +Vector~int~ positions
  +int qts
}

class Dialog {
  +Peer peer
  +int top_message
  +int read_inbox_max_id
  +int read_outbox_max_id
  +int unread_count
  +int unread_mentions_count
  +int unread_reactions_count
  +int unread_poll_votes_count
  +PeerNotifySettings notify_settings
  +int pts
  +DraftMessage draft
  +int folder_id
  +int ttl_period
}

class ForumTopic {
  +int id
  +int date
  +Peer peer
  +string title
  +int icon_color
  +long icon_emoji_id
  +int top_message
  +int read_inbox_max_id
  +int read_outbox_max_id
  +int unread_count
  +int unread_mentions_count
  +int unread_reactions_count
  +int unread_poll_votes_count
  +Peer from_id
  +PeerNotifySettings notify_settings
  +DraftMessage draft
  +bool my
  +bool closed
  +bool pinned
  +bool short
  +bool hidden
  +bool title_missing
}

class ReactionsNotifySettings {
  +ReactionNotificationsFrom messages_notify_from
  +ReactionNotificationsFrom stories_notify_from
  +ReactionNotificationsFrom poll_votes_notify_from
  +NotificationSound sound
  +bool show_previews
}

Poll --> "*" PollAnswer
Poll --> "*" PollResults
PollResults --> "*" PollAnswerVoters
PollResults --> "*" Peer : recent_voters
PollResults --> MessageMedia : solution_media
PollAnswer --> MessageMedia : media
PollAnswer --> Peer : added_by
InputPollAnswer --> InputMedia : media
InputMediaPoll --> Poll
InputMediaPoll --> InputMedia : attached_media
InputMediaPoll --> InputMedia : solution_media
MessageMediaPoll --> Poll
MessageMediaPoll --> PollResults
MessageMediaPoll --> MessageMedia : attached_media
MessageReplyHeader --> MessageMedia : reply_media
MessageReplyHeader --> Peer : reply_to_peer_id
MessageReplyHeader --> MessageFwdHeader : reply_from
MessageReplyHeader --> MessageEntity : quote_entities
InputReplyToMessage --> InputPeer : reply_to_peer_id
InputReplyToMessage --> InputPeer : monoforum_peer_id
InputReplyToMessage --> MessageEntity : quote_entities
UpdateMessagePoll --> Poll
UpdateMessagePoll --> PollResults
UpdateMessagePoll --> Peer
UpdateMessagePollVote --> Peer
Dialog --> Peer
Dialog --> PeerNotifySettings
Dialog --> DraftMessage
ForumTopic --> Peer
ForumTopic --> PeerNotifySettings
ForumTopic --> DraftMessage
ReactionsNotifySettings --> ReactionNotificationsFrom
ReactionsNotifySettings --> NotificationSound
Loading

Class diagram for updated media, story, bot, and auth TL types (Layer 224)

classDiagram
class InputMediaUploadedPhoto {
  +bool spoiler
  +bool live_photo
  +InputFile file
  +Vector~InputDocument~ stickers
  +int ttl_seconds
  +InputDocument video
}

class InputMediaPhoto {
  +bool spoiler
  +bool live_photo
  +InputPhoto id
  +int ttl_seconds
  +InputDocument video
}

class MessageMediaPhoto {
  +bool spoiler
  +bool live_photo
  +Photo photo
  +int ttl_seconds
  +Document video
}

class StoryItem {
  +int id
  +int date
  +Peer from_id
  +StoryFwdHeader fwd_from
  +int expire_date
  +string caption
  +Vector~MessageEntity~ entities
  +MessageMedia media
  +Vector~MediaArea~ media_areas
  +Vector~PrivacyRule~ privacy
  +StoryViews views
  +Reaction sent_reaction
  +Vector~int~ albums
  +Document music
  +bool pinned
  +bool public
  +bool close_friends
  +bool min
  +bool noforwards
  +bool edited
  +bool contacts
  +bool selected_contacts
  +bool out
}

class UrlAuthResultRequest {
  +bool request_write_access
  +bool request_phone_number
  +bool match_codes_first
  +bool is_app
  +User bot
  +string domain
  +string browser
  +string platform
  +string ip
  +string region
  +Vector~string~ match_codes
  +long user_id_hint
  +string verified_app_name
}

class User {
  +long id
  +long access_hash
  +string first_name
  +string last_name
  +string username
  +string phone
  +UserProfilePhoto photo
  +UserStatus status
  +int bot_info_version
  +Vector~RestrictionReason~ restriction_reason
  +string bot_inline_placeholder
  +string lang_code
  +EmojiStatus emoji_status
  +Vector~Username~ usernames
  +RecentStory stories_max_id
  +PeerColor color
  +PeerColor profile_color
  +int bot_active_users
  +long bot_verification_icon
  +long send_paid_messages_stars
  +bool self
  +bool contact
  +bool mutual_contact
  +bool deleted
  +bool bot
  +bool bot_chat_history
  +bool bot_nochats
  +bool verified
  +bool restricted
  +bool min
  +bool bot_inline_geo
  +bool support
  +bool scam
  +bool apply_min_photo
  +bool fake
  +bool bot_attach_menu
  +bool premium
  +bool attach_menu_enabled
  +bool bot_can_edit
  +bool close_friend
  +bool stories_hidden
  +bool stories_unavailable
  +bool contact_require_premium
  +bool bot_business
  +bool bot_has_main_app
  +bool bot_forum_view
  +bool bot_forum_can_manage_topics
  +bool bot_can_manage_bots
}

class UserFull {
  +long id
  +string about
  +PeerSettings settings
  +Photo personal_photo
  +Photo profile_photo
  +Photo fallback_photo
  +PeerNotifySettings notify_settings
  +BotInfo bot_info
  +int pinned_msg_id
  +int common_chats_count
  +int folder_id
  +int ttl_period
  +ChatTheme theme
  +string private_forward_name
  +ChatAdminRights bot_group_admin_rights
  +ChatAdminRights bot_broadcast_admin_rights
  +WallPaper wallpaper
  +PeerStories stories
  +BusinessWorkHours business_work_hours
  +BusinessLocation business_location
  +BusinessGreetingMessage business_greeting_message
  +BusinessAwayMessage business_away_message
  +BusinessIntro business_intro
  +Birthday birthday
  +long personal_channel_id
  +int personal_channel_message
  +int stargifts_count
  +StarRefProgram starref_program
  +BotVerification bot_verification
  +long send_paid_messages_stars
  +DisallowedGiftsSettings disallowed_gifts
  +StarsRating stars_rating
  +StarsRating stars_my_pending_rating
  +int stars_my_pending_rating_date
  +ProfileTab main_tab
  +Document saved_music
  +TextWithEntities note
  +long bot_manager_id
  +bool blocked
  +bool phone_calls_available
  +bool phone_calls_private
  +bool can_pin_message
  +bool has_scheduled
  +bool video_calls_available
  +bool voice_messages_forbidden
  +bool translations_disabled
  +bool stories_pinned_available
  +bool blocked_my_stories_from
  +bool wallpaper_overridden
  +bool contact_require_premium
  +bool read_dates_private
  +bool sponsored_enabled
  +bool can_view_revenue
  +bool bot_can_manage_emoji_status
  +bool display_gifts_button
  +bool noforwards_my_enabled
  +bool noforwards_peer_enabled
  +bool unofficial_security_risk
}

class RequestPeerTypeCreateBot {
  +bool bot_managed
  +string suggested_name
  +string suggested_username
}

class InputMessageReadMetric {
  +int msg_id
  +long view_id
  +int time_in_view_ms
  +int active_time_in_view_ms
  +int height_to_viewport_ratio_permille
  +int seen_range_ratio_permille
}

class BotsExportedBotToken {
  +string token
}

class BotsRequestedButton {
  +string webapp_req_id
}

class MessagesComposedMessageWithAI {
  +TextWithEntities result_text
  +TextWithEntities diff_text
}

InputMediaUploadedPhoto --> InputFile : file
InputMediaUploadedPhoto --> InputDocument : video
InputMediaUploadedPhoto --> InputDocument : stickers
InputMediaPhoto --> InputPhoto : id
InputMediaPhoto --> InputDocument : video
MessageMediaPhoto --> Photo
MessageMediaPhoto --> Document : video
StoryItem --> Peer : from_id
StoryItem --> StoryFwdHeader : fwd_from
StoryItem --> MessageEntity : entities
StoryItem --> MessageMedia : media
StoryItem --> MediaArea : media_areas
StoryItem --> PrivacyRule : privacy
StoryItem --> StoryViews : views
StoryItem --> Reaction : sent_reaction
StoryItem --> Document : music
UrlAuthResultRequest --> User : bot
UrlAuthResultRequest --> string : match_codes
User --> UserProfilePhoto : photo
User --> UserStatus : status
User --> RestrictionReason : restriction_reason
User --> EmojiStatus : emoji_status
User --> Username : usernames
User --> RecentStory : stories_max_id
User --> PeerColor : color
User --> PeerColor : profile_color
User --> BotVerificationIcon : bot_verification_icon
UserFull --> PeerSettings : settings
UserFull --> Photo : personal_photo
UserFull --> Photo : profile_photo
UserFull --> Photo : fallback_photo
UserFull --> PeerNotifySettings : notify_settings
UserFull --> BotInfo : bot_info
UserFull --> ChatTheme : theme
UserFull --> ChatAdminRights : bot_group_admin_rights
UserFull --> ChatAdminRights : bot_broadcast_admin_rights
UserFull --> WallPaper : wallpaper
UserFull --> PeerStories : stories
UserFull --> BusinessWorkHours : business_work_hours
UserFull --> BusinessLocation : business_location
UserFull --> BusinessGreetingMessage : business_greeting_message
UserFull --> BusinessAwayMessage : business_away_message
UserFull --> BusinessIntro : business_intro
UserFull --> Birthday : birthday
UserFull --> StarRefProgram : starref_program
UserFull --> BotVerification : bot_verification
UserFull --> DisallowedGiftsSettings : disallowed_gifts
UserFull --> StarsRating : stars_rating
UserFull --> StarsRating : stars_my_pending_rating
UserFull --> ProfileTab : main_tab
UserFull --> Document : saved_music
UserFull --> TextWithEntities : note
UserFull --> long : bot_manager_id
RequestPeerTypeCreateBot --> string : suggested_name
RequestPeerTypeCreateBot --> string : suggested_username
InputMessageReadMetric --> int : msg_id
BotsExportedBotToken --> string : token
BotsRequestedButton --> string : webapp_req_id
MessagesComposedMessageWithAI --> TextWithEntities : result_text
MessagesComposedMessageWithAI --> TextWithEntities : diff_text
Loading

File-Level Changes

Change Details Files
Bump Telegram API schema to layer 224 and extend core TL types for polls, media, dialogs, stories, reactions and bots.
  • Update numerous constructors in main_api.tl to new layer IDs and add fields for live photos and associated videos on input and message media types.
  • Extend poll-related types to support integer-based answers, attached media, solution media, unread vote tracking, hash-based caching, revoting and open answers, and richer answer metadata including media, author and date.
  • Add new message actions and updates for poll answer append/delete, managed bot creation/updates, dialog and forum unread poll vote counts, and poll vote positions.
  • Introduce new message entities for diff-style annotations (insert/replace/delete) and extend reply headers to reference a specific poll option.
  • Add new filters, notifications and settings for poll-related content (inputMessagesFilterPoll, unread_poll_votes_count in dialogs/topics, poll_votes_notify_from in reactions settings).
  • Add new TL types and RPCs for AI-assisted message composition, read metrics reporting, music listening reports, poll answer add/delete/read, and bot management (username check, creation, token export, webview button flows).
  • Extend story and URL auth types to carry music documents and additional app verification metadata, and add minor flags across user/userFull for bot management and security risk indication.
  • Update comments to indicate protocol layer 224.
compiler/api/source/main_api.tl
Expose new SendMedia options in send_cached_media and copy_message helpers, wiring them through to raw API calls.
  • Extend send_cached_media signature with schedule_repeat_period, allow_paid_stars, message_effect_id, quick_reply_shortcut, send_as, background, clear_draft, update_stickersets_order and suggested_post parameters and document them in the docstring.
  • Pass the new parameters through to raw.functions.messages.SendMedia, converting send_as to an input peer, resolving quick_reply_shortcut, and serializing suggested_post when present.
  • Remove duplicated get_input_media_from_file_id/spoiler assignment in send_cached_media.
  • Extend copy_message signature and docstring with the same new options and forward them to send_cached_media so high-level copy operations can use the extended SendMedia features.
pyrogram/methods/messages/send_cached_media.py
pyrogram/methods/messages/copy_message.py
Propagate message_effect_id through high-level Message.copy wrapper.
  • Update Message.copy paths to pass message_effect_id down to underlying copy_message/send_cached_media calls so effects set by callers are preserved.
pyrogram/types/messages_and_media/message.py
Update project repository metadata to new GitHub organization.
  • Change homepage and repository URLs in pyproject.toml to point to the AeonOrg/Electrogram GitHub repo.
  • Update Sphinx docs configuration to use the new repo URL for the docs site header/links.
pyproject.toml
docs/source/conf.py
Miscellaneous documentation and dependency lockfile updates.
  • Touch various documentation source files (index, install, support) likely for content or branding adjustments aligned with the new org (diff not shown).
  • Regenerate or update uv.lock to reflect dependency state consistent with this release.
docs/source/index.rst
docs/source/intro/install.rst
docs/source/support.rst
pyrogram/__init__.py
uv.lock

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In send_cached_media (and the underlying SendMedia call), invert_media now defaults to None instead of False; if existing callers relied on a strict boolean default, consider whether this silent behavioral/API change is acceptable or if keeping a concrete default is safer for backward compatibility.
  • The high-level Message.copy helper only gained message_effect_id, but not other new options like schedule_repeat_period, background, clear_draft, update_stickersets_order, or suggested_post; consider exposing these through Message.copy as well for consistency with copy_message.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `send_cached_media` (and the underlying `SendMedia` call), `invert_media` now defaults to `None` instead of `False`; if existing callers relied on a strict boolean default, consider whether this silent behavioral/API change is acceptable or if keeping a concrete default is safer for backward compatibility.
- The high-level `Message.copy` helper only gained `message_effect_id`, but not other new options like `schedule_repeat_period`, `background`, `clear_draft`, `update_stickersets_order`, or `suggested_post`; consider exposing these through `Message.copy` as well for consistency with `copy_message`.

## Individual Comments

### Comment 1
<location path="pyrogram/methods/messages/send_cached_media.py" line_range="192" />
<code_context>
+                send_as=utils.get_input_peer(await self.resolve_peer(send_as))
+                if send_as
+                else None,
+                quick_reply_shortcut=await utils.get_input_quick_reply_shortcut(
+                    quick_reply_shortcut,
+                )
</code_context>
<issue_to_address>
**issue (bug_risk):** Using truthiness to gate `quick_reply_shortcut` may skip valid values like `0`.

Because `0` and `""` are falsy, this pattern will skip resolving a valid shortcut even though `int` is accepted. If `0` can be a valid shortcut ID, gate on `is not None` instead:

```python
quick_reply_shortcut = await utils.get_input_quick_reply_shortcut(quick_reply_shortcut)
if quick_reply_shortcut is not None
else None,
```

Please also update other call sites that rely on `quick_reply_shortcut` truthiness in the same way.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

send_as=utils.get_input_peer(await self.resolve_peer(send_as))
if send_as
else None,
quick_reply_shortcut=await utils.get_input_quick_reply_shortcut(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Using truthiness to gate quick_reply_shortcut may skip valid values like 0.

Because 0 and "" are falsy, this pattern will skip resolving a valid shortcut even though int is accepted. If 0 can be a valid shortcut ID, gate on is not None instead:

quick_reply_shortcut = await utils.get_input_quick_reply_shortcut(quick_reply_shortcut)
if quick_reply_shortcut is not None
else None,

Please also update other call sites that rely on quick_reply_shortcut truthiness in the same way.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the MTProto schema to Layer 224, introducing a wide range of new fields and methods related to polls, managed bots, and message effects. It also migrates the project's repository URL to the AeonOrg organization and bumps the version to v0.3.224. Key functional updates include adding several parameters to the copy_message and send_cached_media methods. However, critical issues were identified in the schema definitions where constructor IDs were not updated to reflect field changes, which will lead to serialization errors. Additionally, runtime TypeError bugs were found in the Message.copy method due to redundant keyword arguments being passed to partial function objects.


userEmpty#d3bc4b7a id:long = User;
user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;
user#31774388 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true bot_forum_can_manage_topics:flags2.17?true bot_can_manage_bots:flags2.18?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?RecentStory color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The constructor ID for user (#31774388) has not been updated despite the addition of the bot_can_manage_bots field. In MTProto, the constructor ID is a CRC32 hash of the definition string; any change to the fields (including adding flags) must result in a new ID to avoid serialization errors and binary incompatibility.

payments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector<InputSavedStarGift> = Bool;
payments.canPurchaseStore#4fdc5ea7 purpose:InputStorePaymentPurpose = Bool;
payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector<StarGiftAttributeId> offset:string limit:int = payments.ResaleStarGifts;
payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true for_craft:flags.4?true stars_only:flags.5?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector<StarGiftAttributeId> offset:string limit:int = payments.ResaleStarGifts;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The constructor ID for payments.getResaleStarGifts (#7a5fa236) remains unchanged even though the stars_only field was added. This will lead to binary serialization issues as the hex ID no longer matches the definition string's hash. Please update the hex ID to reflect the new schema definition.

message_thread_id=message_thread_id,
allow_paid_broadcast=allow_paid_broadcast,
allow_paid_stars=allow_paid_stars,
message_effect_id=message_effect_id,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line introduces a TypeError at runtime. The send_media object is a partial created at line 5188 which already includes message_effect_id=message_effect_id (line 5201). In Python, providing a keyword argument to a partial that was already specified during its creation results in a TypeError: multiple values for keyword argument. Note that other parameters in this call (like message_thread_id, allow_paid_broadcast, etc.) are also duplicated from the partial and should be removed from the call to avoid similar errors.

message_thread_id=message_thread_id,
allow_paid_broadcast=allow_paid_broadcast,
allow_paid_stars=allow_paid_stars,
message_effect_id=message_effect_id,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Redundant keyword argument message_effect_id. Since send_media is a partial that already binds this parameter (see line 5201), passing it again here will cause a TypeError. The call should only include arguments not already present in the partial (such as file_id and caption).

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread uv.lock
@@ -1801,69 +1817,69 @@ wheels = [

[[package]]
name = "starlette"
version = "0.52.1"
version = "1.0.0"
source = { registry = "https://pypi.org/simple" }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

starlette is being bumped from 0.52.1 to 1.0.0, which is a major-version upgrade and may include breaking changes for any ASGI-related tooling/tests in this repo. Please double-check this upgrade is intentional and that downstream dependencies remain compatible.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

'x.y.z'

.. _`Github repo`: http://github.com/5hojib/Electrogram
.. _`Github repo`: http://github.com/AeonOrg/Electrogram
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This updated “Github repo” link still uses http:// for GitHub, which can cause unnecessary redirects and (in some contexts) mixed-content warnings. Consider switching it to https:// for consistency with the other updated links.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@5hojib 5hojib merged commit 0b462ba into main Apr 4, 2026
4 checks passed
@5hojib 5hojib deleted the beta branch April 4, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant