Compare commits

...

7 commits

Author SHA1 Message Date
dependabot[bot]
36e3eca8b3
build(deps): bump sphinx-immaterial from 0.12.4 to 0.13.4
Some checks are pending
Build-docs / build (push) Waiting to run
Pyrofork / build (macos-latest, 3.10) (push) Waiting to run
Pyrofork / build (macos-latest, 3.11) (push) Waiting to run
Pyrofork / build (macos-latest, 3.12) (push) Waiting to run
Pyrofork / build (macos-latest, 3.13) (push) Waiting to run
Pyrofork / build (macos-latest, 3.9) (push) Waiting to run
Pyrofork / build (ubuntu-latest, 3.10) (push) Waiting to run
Pyrofork / build (ubuntu-latest, 3.11) (push) Waiting to run
Pyrofork / build (ubuntu-latest, 3.12) (push) Waiting to run
Pyrofork / build (ubuntu-latest, 3.13) (push) Waiting to run
Pyrofork / build (ubuntu-latest, 3.9) (push) Waiting to run
Bumps [sphinx-immaterial](https://github.com/jbms/sphinx-immaterial) from 0.12.4 to 0.13.4.
- [Release notes](https://github.com/jbms/sphinx-immaterial/releases)
- [Commits](https://github.com/jbms/sphinx-immaterial/compare/v0.12.4...v0.13.4)

---
updated-dependencies:
- dependency-name: sphinx-immaterial
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-09 22:12:14 +07:00
wulan17
7ada139ee3
pyrofork: client: fix looping prompt when use qrcode as input
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-07-09 21:39:54 +07:00
wulan17
d66907159f
pyrofork: Drop translation
* disabled by telegram

Signed-off-by: wulan17 <wulan17@komodos.id>
2025-07-09 20:52:58 +07:00
wulan17
efff9d5340
pyrofork: Add resale_amount field to Gift (#144)
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-07-09 19:41:20 +07:00
wulan17
90716bcef8
pyrofork: Update API schema to Layer 207
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-07-09 18:47:45 +07:00
Hentinel
bb830ce1b0
pyrofork: Allow to specify system_lang_code and lang_pack (#129)
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-07-09 18:44:41 +07:00
Otazuki
2e42fba498
pyrofork: Add transfer_chat_ownership method (#145)
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-07-09 18:42:08 +07:00
13 changed files with 119 additions and 245 deletions

View file

@ -1899,11 +1899,11 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true
starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption;
starGift#c62aca28 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string = StarGift; starGift#7f853c12 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer = StarGift;
starGiftUnique#6411db89 flags:# id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int gift_address:flags.3?string resell_stars:flags.4?long = StarGift; starGiftUnique#f63778ae flags:# id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int gift_address:flags.3?string resell_stars:flags.4?long released_by:flags.5?Peer = StarGift;
payments.starGiftsNotModified#a388a368 = payments.StarGifts; payments.starGiftsNotModified#a388a368 = payments.StarGifts;
payments.starGifts#901689ea hash:int gifts:Vector<StarGift> = payments.StarGifts; payments.starGifts#2ed82995 hash:int gifts:Vector<StarGift> chats:Vector<Chat> users:Vector<User> = payments.StarGifts;
messageReportOption#7903e3d9 text:string option:bytes = MessageReportOption; messageReportOption#7903e3d9 text:string option:bytes = MessageReportOption;
@ -2729,4 +2729,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool;
fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;
// LAYER 206 // LAYER 207

View file

@ -225,7 +225,6 @@ def pyrogram_api():
get_discussion_replies_count get_discussion_replies_count
get_custom_emoji_stickers get_custom_emoji_stickers
transcribe_audio transcribe_audio
translate_message_text
start_bot start_bot
delete_chat_history delete_chat_history
""", """,
@ -285,6 +284,7 @@ def pyrogram_api():
hide_general_topic hide_general_topic
reopen_forum_topic reopen_forum_topic
reopen_general_topic reopen_general_topic
transfer_chat_ownership
unhide_general_topic unhide_general_topic
update_color update_color
update_folder update_folder
@ -568,7 +568,6 @@ def pyrogram_api():
WebPageEmpty WebPageEmpty
WebPagePreview WebPagePreview
TranscribedAudio TranscribedAudio
TranslatedText
TextQuote TextQuote
Poll Poll
PollOption PollOption
@ -821,7 +820,6 @@ def pyrogram_api():
Message.get_media_group Message.get_media_group
Message.react Message.react
Message.transcribe Message.transcribe
Message.translate
Message.wait_for_click Message.wait_for_click
""", """,
chat=""" chat="""

View file

@ -60,7 +60,7 @@ dev = [
docs = [ docs = [
"sphinx", "sphinx",
"sphinx-immaterial==0.12.4", "sphinx-immaterial==0.12.5",
"sphinx_copybutton", "sphinx_copybutton",
"sphinx-autobuild", "sphinx-autobuild",
"tornado>=6.3.3" "tornado>=6.3.3"

View file

@ -227,6 +227,8 @@ class Client(Methods):
SYSTEM_VERSION = f"{platform.system()} {platform.release()}" SYSTEM_VERSION = f"{platform.system()} {platform.release()}"
LANG_CODE = "en" LANG_CODE = "en"
LANG_PACK = ""
SYSTEM_LANG_CODE = "en-US"
PARENT_DIR = Path(sys.argv[0]).parent PARENT_DIR = Path(sys.argv[0]).parent
@ -252,7 +254,9 @@ class Client(Methods):
app_version: str = APP_VERSION, app_version: str = APP_VERSION,
device_model: str = DEVICE_MODEL, device_model: str = DEVICE_MODEL,
system_version: str = SYSTEM_VERSION, system_version: str = SYSTEM_VERSION,
system_lang_code: str = SYSTEM_LANG_CODE,
lang_code: str = LANG_CODE, lang_code: str = LANG_CODE,
lang_pack: str = LANG_PACK,
ipv6: Optional[bool] = False, ipv6: Optional[bool] = False,
alt_port: Optional[bool] = False, alt_port: Optional[bool] = False,
proxy: Optional[dict] = None, proxy: Optional[dict] = None,
@ -288,7 +292,9 @@ class Client(Methods):
self.app_version = app_version self.app_version = app_version
self.device_model = device_model self.device_model = device_model
self.system_version = system_version self.system_version = system_version
self.system_lang_code = system_lang_code.lower()
self.lang_code = lang_code.lower() self.lang_code = lang_code.lower()
self.lang_pack = lang_pack.lower()
self.ipv6 = ipv6 self.ipv6 = ipv6
self.alt_port = alt_port self.alt_port = alt_port
self.proxy = proxy self.proxy = proxy
@ -445,25 +451,25 @@ class Client(Methods):
return await self.sign_in_bot(value) return await self.sign_in_bot(value)
else: else:
self.phone_number = value self.phone_number = value
if not self.use_qrcode:
sent_code = await self.send_code(self.phone_number) sent_code = await self.send_code(self.phone_number)
except BadRequest as e: except BadRequest as e:
print(e.MESSAGE) print(e.MESSAGE)
self.phone_number = None self.phone_number = None
self.bot_token = None self.bot_token = None
else: else:
break break
if not self.use_qrcode:
sent_code_descriptions = {
enums.SentCodeType.APP: "Telegram app",
enums.SentCodeType.SMS: "SMS",
enums.SentCodeType.CALL: "phone call",
enums.SentCodeType.FLASH_CALL: "phone flash call",
enums.SentCodeType.FRAGMENT_SMS: "Fragment SMS",
enums.SentCodeType.EMAIL_CODE: "email code"
}
sent_code_descriptions = { print(f"The confirmation code has been sent via {sent_code_descriptions[sent_code.type]}")
enums.SentCodeType.APP: "Telegram app",
enums.SentCodeType.SMS: "SMS",
enums.SentCodeType.CALL: "phone call",
enums.SentCodeType.FLASH_CALL: "phone flash call",
enums.SentCodeType.FRAGMENT_SMS: "Fragment SMS",
enums.SentCodeType.EMAIL_CODE: "email code"
}
print(f"The confirmation code has been sent via {sent_code_descriptions[sent_code.type]}")
while True: while True:
if not self.use_qrcode and not self.phone_code: if not self.use_qrcode and not self.phone_code:

View file

@ -67,6 +67,7 @@ from .set_chat_title import SetChatTitle
from .set_chat_username import SetChatUsername from .set_chat_username import SetChatUsername
from .set_send_as_chat import SetSendAsChat from .set_send_as_chat import SetSendAsChat
from .set_slow_mode import SetSlowMode from .set_slow_mode import SetSlowMode
from .transfer_chat_ownership import TransferChatOwnership
from .unarchive_chats import UnarchiveChats from .unarchive_chats import UnarchiveChats
from .unban_chat_member import UnbanChatMember from .unban_chat_member import UnbanChatMember
from .unpin_all_chat_messages import UnpinAllChatMessages from .unpin_all_chat_messages import UnpinAllChatMessages
@ -130,6 +131,7 @@ class Chats(
GetSendAsChats, GetSendAsChats,
SetSendAsChat, SetSendAsChat,
SetChatProtectedContent, SetChatProtectedContent,
TransferChatOwnership,
UpdateColor, UpdateColor,
UpdateFolder UpdateFolder
): ):

View file

@ -0,0 +1,83 @@
# Pyrofork - Telegram MTProto API Client Library for Python
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrofork.
#
# Pyrofork is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrofork is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import Union
import pyrogram
from pyrogram import raw, utils
class TransferChatOwnership:
async def transfer_chat_ownership(
self: "pyrogram.Client",
chat_id: Union[int, str],
user_id: Union[int, str],
password: str,
) -> bool:
"""Transfer the owner of a chat or channel to another user.
.. note:
Requires owner privileges.
.. include:: /_includes/usable-by/users.rst
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
Unique identifier for the target chat in form of a *t.me/joinchat/* link, identifier (int) or username
of the target channel/supergroup (in the format @username).
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the new owner.
For a contact that exists in your Telegram address book you can use his phone number (str).
password (``str``):
The 2-step verification password of the current user.
Returns:
``bool``: True on success.
Raises:
ValueError: In case of invalid parameters.
RPCError: In case of a Telegram RPC error.
Example:
.. code-block:: python
await app.transfer_chat_ownership(chat_id, user_id, "password")
"""
peer_channel = await self.resolve_peer(chat_id)
peer_user = await self.resolve_peer(user_id)
if not isinstance(peer_channel, raw.types.InputPeerChannel):
raise ValueError("The chat_id must belong to a channel/supergroup.")
if not isinstance(peer_user, raw.types.InputPeerUser):
raise ValueError("The user_id must belong to a user.")
r = await self.invoke(
raw.functions.channels.EditCreator(
channel=peer_channel,
user_id=peer_user,
password=utils.compute_password_check(
await self.invoke(raw.functions.account.GetPassword()), password
),
)
)
return bool(r)

View file

@ -79,7 +79,6 @@ from .stop_poll import StopPoll
from .stream_media import StreamMedia from .stream_media import StreamMedia
from .vote_poll import VotePoll from .vote_poll import VotePoll
from .transcribe_audio import TranscribeAudio from .transcribe_audio import TranscribeAudio
from .translate_text import TranslateText
class Messages( class Messages(
AddTaskToTodo, AddTaskToTodo,
@ -143,7 +142,6 @@ class Messages(
StreamMedia, StreamMedia,
GetCustomEmojiStickers, GetCustomEmojiStickers,
TranscribeAudio, TranscribeAudio,
TranslateText,
StartBot StartBot
): ):
pass pass

View file

@ -1,121 +0,0 @@
# Pyrofork - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrofork.
#
# Pyrofork is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrofork is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import List, Optional, Union
import pyrogram
from pyrogram import enums, raw, types, utils
class TranslateText:
async def translate_message_text(
self: "pyrogram.Client",
to_language_code: str,
chat_id: Optional[Union[int, str]] = None,
message_ids: Optional[Union[int, List[int]]] = None,
text: Optional[str] = None,
parse_mode: Optional["enums.ParseMode"] = None,
entities: Optional[List["types.MessageEntity"]] = None
) -> Union["types.TranslatedText", List["types.TranslatedText"]]:
"""Translates a text or message(s) to the given language. If the current user is a Telegram Premium user, then text formatting is preserved.
Parameters:
to_language_code (``str``):
Language code of the language to which the message/text is translated.
Must be one of the supported language codes.
chat_id (``Optional[int | str]``):
Unique identifier (int) or username (str) of the target chat.
message_ids (``Optional[int | List[int]]``):
Identifier or list of message identifiers of the target message(s).
text (``Optional[str]``):
Text to translate.
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
By default, texts are parsed using both Markdown and HTML styles.
You can combine both syntaxes together.
entities (List of :obj:`~pyrogram.types.MessageEntity`):
List of special entities that appear in message text, which can be specified instead of *parse_mode*.
Example:
.. code-block:: python
# Using chat_id and message_ids
await app.translate_message_text("en", chat_id, message_ids)
# Using text
await app.translate_message_text("en", text="Hello, how are you?")
# Using text with parse_mode
await app.translate_message_text("en", text="*Hello*, how are you?", parse_mode=ParseMode.MARKDOWN)
# Using text with entities
entities = [types.MessageEntityBold(offset=0, length=5)]
await app.translate_message_text("en", text="*Hello*, how are you?", entities=entities)
Returns:
:obj:`~pyrogram.types.TranslatedText` | List of :obj:`~pyrogram.types.TranslatedText`: In case *message_ids* was not
a list, a single result is returned, otherwise a list of results is returned.
"""
if text is not None:
message, entities = (
await utils.parse_text_entities(
self,
text,
parse_mode,
entities
)
).values()
r = await self.invoke(
raw.functions.messages.TranslateText(
to_lang=to_language_code,
text=[
raw.types.TextWithEntities(
text=message,
entities=entities or []
)
]
)
)
elif chat_id is not None and message_ids is not None:
ids = [message_ids] if not isinstance(message_ids, list) else message_ids
r = await self.invoke(
raw.functions.messages.TranslateText(
to_lang=to_language_code,
peer=await self.resolve_peer(chat_id),
id=ids
)
)
else:
raise ValueError("Either 'text' or both 'chat_id' and 'message_ids' must be provided.")
return (
types.TranslatedText._parse(self, r.result[0])
if len(r.result) == 1
else [
types.TranslatedText._parse(self, i)
for i in r.result
]
)

View file

@ -131,9 +131,9 @@ class Session:
app_version=self.client.app_version, app_version=self.client.app_version,
device_model=self.client.device_model, device_model=self.client.device_model,
system_version=self.client.system_version, system_version=self.client.system_version,
system_lang_code=self.client.lang_code, system_lang_code=self.client.system_lang_code,
lang_code=self.client.lang_code, lang_code=self.client.lang_code,
lang_pack="", lang_pack=self.client.lang_pack,
query=raw.functions.help.GetConfig(), query=raw.functions.help.GetConfig(),
) )
), ),

View file

@ -82,7 +82,6 @@ from .exported_story_link import ExportedStoryLink
from .wallpaper import Wallpaper from .wallpaper import Wallpaper
from .wallpaper_settings import WallpaperSettings from .wallpaper_settings import WallpaperSettings
from .transcribed_audio import TranscribedAudio from .transcribed_audio import TranscribedAudio
from .translated_text import TranslatedText
from .text_quote import TextQuote from .text_quote import TextQuote
__all__ = [ __all__ = [
@ -146,7 +145,6 @@ __all__ = [
"Wallpaper", "Wallpaper",
"WallpaperSettings", "WallpaperSettings",
"TranscribedAudio", "TranscribedAudio",
"TranslatedText",
"TextQuote", "TextQuote",
"TodoList", "TodoList",
"TodoTask", "TodoTask",

View file

@ -5635,40 +5635,3 @@ class Message(Object, Update):
chat_id=self.chat.id, chat_id=self.chat.id,
message_id=self.id message_id=self.id
) )
async def translate(
self,
to_language_code: str
) -> "types.TranslatedText":
"""Bound method *translate* of :obj:`~pyrogram.types.Message`.
Use as a shortcut for:
.. code-block:: python
await client.translate_message_text(
chat_id=message.chat.id,
message_ids=message_id,
to_language_code="en"
)
Example:
.. code-block:: python
await Message.translate("en")
Parameters:
to_language_code (``str``):
Language code of the language to which the message is translated.
Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu".
Returns:
:obj:`~pyrogram.types.TranslatedText`: The translated result is returned.
Raises:
RPCError: In case of a Telegram RPC error.
"""
return await self._client.translate_message_text(
chat_id=self.chat.id,
message_ids=self.id,
to_language_code=to_language_code
)

View file

@ -1,61 +0,0 @@
# Pyrofork - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrofork.
#
# Pyrofork is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrofork is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import List
from pyrogram import raw, types
from ..object import Object
from .message import Str
class TranslatedText(Object):
"""A translated text with entities.
Parameters:
text (``str``):
Translated text.
entities (``str``, *optional*):
Entities of the text.
"""
def __init__(
self,
*,
text: str,
entities: List["types.MessageEntity"] = None
):
self.text = text
self.entities = entities
@staticmethod
def _parse(
client,
translate_result: "raw.types.TextWithEntities"
) -> "TranslatedText":
entities = [
types.MessageEntity._parse(client, entity, {})
for entity in translate_result.entities
]
entities = types.List(filter(lambda x: x is not None, entities))
return TranslatedText(
text=Str(translate_result.text).init(entities) or None, entities=entities or None
)

View file

@ -104,6 +104,10 @@ class Gift(Object):
The number of gifts available for purchase. The number of gifts available for purchase.
Returned only if is_limited is True. Returned only if is_limited is True.
resale_amount (``int``, *optional*):
The number of gifts available for resale.
Returned only if is_limited is True.
total_amount (``int``, *optional*): total_amount (``int``, *optional*):
Total amount of gifts. Total amount of gifts.
Returned only if is_limited is True. Returned only if is_limited is True.
@ -177,6 +181,7 @@ class Gift(Object):
collectible_id: Optional[int] = None, collectible_id: Optional[int] = None,
attributes: Optional[List["types.GiftAttribute"]] = None, attributes: Optional[List["types.GiftAttribute"]] = None,
available_amount: Optional[int] = None, available_amount: Optional[int] = None,
resale_amount: Optional[int] = None,
total_amount: Optional[int] = None, total_amount: Optional[int] = None,
can_upgrade: Optional[bool] = None, can_upgrade: Optional[bool] = None,
can_export_at: Optional[datetime] = None, can_export_at: Optional[datetime] = None,
@ -216,6 +221,7 @@ class Gift(Object):
self.collectible_id = collectible_id self.collectible_id = collectible_id
self.attributes = attributes self.attributes = attributes
self.available_amount = available_amount self.available_amount = available_amount
self.resale_amount = resale_amount
self.total_amount = total_amount self.total_amount = total_amount
self.can_upgrade = can_upgrade self.can_upgrade = can_upgrade
self.can_export_at = can_export_at self.can_export_at = can_export_at
@ -254,6 +260,7 @@ class Gift(Object):
convert_price=star_gift.convert_stars, convert_price=star_gift.convert_stars,
upgrade_price=getattr(star_gift, "upgrade_stars", None), upgrade_price=getattr(star_gift, "upgrade_stars", None),
available_amount=getattr(star_gift, "availability_remains", None), available_amount=getattr(star_gift, "availability_remains", None),
resale_amount=getattr(star_gift, "availability_resale", None),
total_amount=getattr(star_gift, "availability_total", None), total_amount=getattr(star_gift, "availability_total", None),
is_limited=getattr(star_gift, "limited", None), is_limited=getattr(star_gift, "limited", None),
is_sold_out=getattr(star_gift, "sold_out", None), is_sold_out=getattr(star_gift, "sold_out", None),
@ -281,6 +288,7 @@ class Gift(Object):
[await types.GiftAttribute._parse(client, attr, users) for attr in star_gift.attributes] [await types.GiftAttribute._parse(client, attr, users) for attr in star_gift.attributes]
) or None, ) or None,
available_amount=getattr(star_gift, "availability_issued", None), available_amount=getattr(star_gift, "availability_issued", None),
resale_amount=getattr(star_gift, "availability_resale", None),
total_amount=getattr(star_gift, "availability_total", None), total_amount=getattr(star_gift, "availability_total", None),
owner=( owner=(
types.Chat._parse_chat(client, users.get(owner_id) or types.Chat._parse_chat(client, users.get(owner_id) or