mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Use weakref proxy instead of ref
This commit is contained in:
parent
58952a7d98
commit
afc2a2e35d
@ -18,13 +18,12 @@
|
|||||||
|
|
||||||
from base64 import b64decode, b64encode
|
from base64 import b64decode, b64encode
|
||||||
from struct import pack
|
from struct import pack
|
||||||
|
from weakref import proxy
|
||||||
|
|
||||||
from pyrogram.client import types as pyrogram_types
|
from pyrogram.client import types as pyrogram_types
|
||||||
from ..api import types, functions
|
from ..api import types, functions
|
||||||
from ..api.errors import StickersetInvalid
|
from ..api.errors import StickersetInvalid
|
||||||
|
|
||||||
from weakref import ref
|
|
||||||
|
|
||||||
# TODO: Organize the code better?
|
# TODO: Organize the code better?
|
||||||
|
|
||||||
ENTITIES = {
|
ENTITIES = {
|
||||||
@ -529,7 +528,7 @@ def parse_message(
|
|||||||
views=message.views,
|
views=message.views,
|
||||||
via_bot=parse_user(users.get(message.via_bot_id, None)),
|
via_bot=parse_user(users.get(message.via_bot_id, None)),
|
||||||
outgoing=message.out,
|
outgoing=message.out,
|
||||||
client=ref(client),
|
client=proxy(client),
|
||||||
reply_markup=reply_markup
|
reply_markup=reply_markup
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -629,7 +628,7 @@ def parse_message_service(
|
|||||||
migrate_from_chat_id=-migrate_from_chat_id if migrate_from_chat_id else None,
|
migrate_from_chat_id=-migrate_from_chat_id if migrate_from_chat_id else None,
|
||||||
group_chat_created=group_chat_created,
|
group_chat_created=group_chat_created,
|
||||||
channel_chat_created=channel_chat_created,
|
channel_chat_created=channel_chat_created,
|
||||||
client=ref(client)
|
client=proxy(client)
|
||||||
# TODO: supergroup_chat_created
|
# TODO: supergroup_chat_created
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -643,7 +642,7 @@ def parse_message_empty(
|
|||||||
client,
|
client,
|
||||||
message: types.MessageEmpty
|
message: types.MessageEmpty
|
||||||
) -> pyrogram_types.Message:
|
) -> pyrogram_types.Message:
|
||||||
return pyrogram_types.Message(message_id=message.id, client=ref(client))
|
return pyrogram_types.Message(message_id=message.id, client=proxy(client))
|
||||||
|
|
||||||
|
|
||||||
def get_peer_id(input_peer) -> int:
|
def get_peer_id(input_peer) -> int:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user