Skip to content
Merged

Beta #123

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 58 additions & 28 deletions compiler/api/source/main_api.tl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"edit": "material/file-edit-outline",
},
"site_url": "https://electrogram-docs.vercel.app/",
"repo_url": "https://github.com/5hojib/Electrogram/",
"repo_url": "https://github.com/AeonOrg/Electrogram/",
"repo_name": "Electrogram",
"globaltoc_collapse": True,
"font": {
Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Welcome to Electrogram
Modern MTProto API Framework for Python
</p>
<div style="margin-top: 12px; display: flex; gap: 8px;">
<a href="https://github.com/5hojib/Electrogram" style="padding: 4px 14px; background: var(--md-primary-fg-color); color: white; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-decoration: none;">GitHub</a>
<a href="https://github.com/5hojib/Electrogram/issues" style="padding: 4px 14px; background: #f5f5f5; color: #333; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-decoration: none;">Issues</a>
<a href="https://github.com/AeonOrg/Electrogram" style="padding: 4px 14px; background: var(--md-primary-fg-color); color: white; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-decoration: none;">GitHub</a>
<a href="https://github.com/AeonOrg/Electrogram/issues" style="padding: 4px 14px; background: #f5f5f5; color: #333; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-decoration: none;">Issues</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/source/intro/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ If no error shows up you are good to go.
>>> pyrogram.__version__
'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.

8 changes: 4 additions & 4 deletions docs/source/support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ Support Electrogram

<div style="float: right; margin-bottom: 10px">
<a class="github-button"
href="https://github.com/5hojib/Electrogram"
href="https://github.com/AeonOrg/Electrogram"
data-color-scheme="no-preference: light; light: light; dark: dark;"
data-icon="octicon-star" data-size="large" data-show-count="true"
aria-label="Star 5hojib/Electrogram on GitHub">Star</a>
aria-label="Star AeonOrg/Electrogram on GitHub">Star</a>

<a class="github-button"
href="https://github.com/5hojib/Electrogram/fork"
href="https://github.com/AeonOrg/Electrogram/fork"
data-color-scheme="no-preference: light; light: light; dark: dark;"
data-icon="octicon-repo-forked" data-size="large"
data-show-count="true" aria-label="Fork 5hojib/Electrogram on GitHub">Fork</a>
data-show-count="true" aria-label="Fork AeonOrg/Electrogram on GitHub">Fork</a>
</div>

<br style="clear: both"/>
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ path = "pyrogram/__init__.py"
[tool.hatch.build.hooks.custom]

[project.urls]
homepage = "https://github.com/5hojib/electrogram"
homepage = "https://github.com/AeonOrg/Electrogram"
community = "https://t.me/ProjectAeon"
repository = "https://github.com/5hojib/electrogram"
repository = "https://github.com/AeonOrg/Electrogram"

[build-system]
requires = ["hatchling"]
Expand Down
2 changes: 1 addition & 1 deletion pyrogram/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

__version__ = "v0.3.223.1"
__version__ = "v0.3.224"
__license__ = "MIT License"

from concurrent.futures.thread import ThreadPoolExecutor
Expand Down
47 changes: 46 additions & 1 deletion pyrogram/methods/messages/copy_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ async def copy_message(
reply_to_message_id: int | None = None,
reply_to_chat_id: int | None = None,
schedule_date: datetime | None = None,
schedule_repeat_period: int | None = None,
protect_content: bool | None = None,
allow_paid_broadcast: bool | None = None,
invert_media: bool = False,
allow_paid_stars: int | None = None,
message_effect_id: int | None = None,
invert_media: bool | None = None,
quick_reply_shortcut: str | int | None = None,
send_as: int | str | None = None,
background: bool | None = None,
clear_draft: bool | None = None,
update_stickersets_order: bool | None = None,
suggested_post: types.SuggestedPost | None = None,
reply_markup: types.InlineKeyboardMarkup
| None
| types.ReplyKeyboardMarkup
Expand Down Expand Up @@ -93,15 +102,42 @@ async def copy_message(
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.

schedule_repeat_period (``int``, *optional*):
Repeat period of the scheduled message.

protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.

allow_paid_broadcast (``bool``, *optional*):
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only.

allow_paid_stars (``int``, *optional*):
Amount of stars to pay for the message; for bots only.

message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.

invert_media (``bool``, *optional*):
Inverts the position of the media and caption.

quick_reply_shortcut (``str`` | ``int``, *optional*):
Quick reply shortcut identifier or name.

send_as (``int`` | ``str``, *optional*):
Unique identifier (int) or username (str) of the chat to send the message as.

background (``bool``, *optional*):
Pass True to send the message in the background.

clear_draft (``bool``, *optional*):
Pass True to clear the draft.

update_stickersets_order (``bool``, *optional*):
Pass True to update the stickersets order.

suggested_post (:obj:`~pyrogram.types.SuggestedPost`, *optional*):
Suggested post information.

reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Expand Down Expand Up @@ -132,9 +168,18 @@ async def copy_message(
reply_to_message_id=reply_to_message_id,
reply_to_chat_id=reply_to_chat_id,
schedule_date=schedule_date,
schedule_repeat_period=schedule_repeat_period,
protect_content=protect_content,
allow_paid_broadcast=allow_paid_broadcast,
allow_paid_stars=allow_paid_stars,
message_effect_id=message_effect_id,
invert_media=invert_media,
quick_reply_shortcut=quick_reply_shortcut,
send_as=send_as,
background=background,
clear_draft=clear_draft,
update_stickersets_order=update_stickersets_order,
suggested_post=suggested_post,
reply_markup=reply_markup,
)

Expand Down
58 changes: 54 additions & 4 deletions pyrogram/methods/messages/send_cached_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ async def send_cached_media(
quote_text: str | None = None,
quote_entities: list[types.MessageEntity] | None = None,
schedule_date: datetime | None = None,
schedule_repeat_period: int | None = None,
protect_content: bool | None = None,
allow_paid_broadcast: bool | None = None,
invert_media: bool = False,
allow_paid_stars: int | None = None,
message_effect_id: int | None = None,
invert_media: bool | None = None,
quick_reply_shortcut: str | int | None = None,
send_as: int | str | None = None,
background: bool | None = None,
clear_draft: bool | None = None,
update_stickersets_order: bool | None = None,
suggested_post: types.SuggestedPost | None = None,
reply_markup: types.InlineKeyboardMarkup
| None
| types.ReplyKeyboardMarkup
Expand Down Expand Up @@ -97,15 +106,42 @@ async def send_cached_media(
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.

schedule_repeat_period (``int``, *optional*):
Repeat period of the scheduled message.

protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.

allow_paid_broadcast (``bool``, *optional*):
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only

allow_paid_stars (``int``, *optional*):
Amount of stars to pay for the message; for bots only.

message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.

invert_media (``bool``, *optional*):
Inverts the position of the media and caption.

quick_reply_shortcut (``str`` | ``int``, *optional*):
Quick reply shortcut identifier or name.

send_as (``int`` | ``str``, *optional*):
Unique identifier (int) or username (str) of the chat to send the message as.

background (``bool``, *optional*):
Pass True to send the message in the background.

clear_draft (``bool``, *optional*):
Pass True to clear the draft.

update_stickersets_order (``bool``, *optional*):
Pass True to update the stickersets order.

suggested_post (:obj:`~pyrogram.types.SuggestedPost`, *optional*):
Suggested post information.

reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Expand Down Expand Up @@ -134,9 +170,6 @@ async def send_cached_media(
media = utils.get_input_media_from_file_id(file_id)
media.spoiler = has_spoiler

media = utils.get_input_media_from_file_id(file_id)
media.spoiler = has_spoiler

r = await self.invoke(
raw.functions.messages.SendMedia(
peer=utils.get_input_peer(await self.resolve_peer(chat_id)),
Expand All @@ -148,6 +181,23 @@ async def send_cached_media(
noforwards=protect_content,
allow_paid_floodskip=allow_paid_broadcast,
invert_media=invert_media,
effect=message_effect_id,
background=background,
clear_draft=clear_draft,
update_stickersets_order=update_stickersets_order,
schedule_repeat_period=schedule_repeat_period,
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.

quick_reply_shortcut,
)
if quick_reply_shortcut
else None,
allow_paid_stars=allow_paid_stars,
suggested_post=await suggested_post.write()
if suggested_post
else None,
reply_markup=await reply_markup.write(self)
if reply_markup
else None,
Expand Down
2 changes: 2 additions & 0 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -5366,6 +5366,7 @@ async def copy(
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.

quick_reply_shortcut=quick_reply_shortcut,
send_as=send_as,
background=background,
Expand All @@ -5386,6 +5387,7 @@ async def copy(
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).

quick_reply_shortcut=quick_reply_shortcut,
send_as=send_as,
background=background,
Expand Down
Loading
Loading