Fix all those unresolved references caused by the refactor · stack-queue/pyrogram@27052e3 · GitHub
Skip to content

Commit 27052e3

Browse files
committed
Fix all those unresolved references caused by the refactor
1 parent dc2792f commit 27052e3

22 files changed

Lines changed: 70 additions & 51 deletions

pyrogram/client/methods/chats/get_chat_members.py

Lines changed: 2 additions & 2 deletions

pyrogram/client/methods/chats/kick_chat_member.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
import pyrogram
1920
from pyrogram.api import functions, types
20-
from pyrogram.client.ext import utils
2121
from ...ext import BaseClient
2222

2323

@@ -86,7 +86,7 @@ def kick_chat_member(self,
8686

8787
for i in r.updates:
8888
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
89-
return utils.parse_messages(
89+
return pyrogram.Message.parse(
9090
self, i.message,
9191
{i.id: i for i in r.users},
9292
{i.id: i for i in r.chats}

pyrogram/client/methods/messages/edit_message_caption.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
import pyrogram
20+
1921
from pyrogram.api import functions, types
20-
from pyrogram.client.ext import BaseClient, utils
22+
from pyrogram.client.ext import BaseClient
2123

2224

2325
class EditMessageCaption(BaseClient):
@@ -68,7 +70,7 @@ def edit_message_caption(self,
6870

6971
for i in r.updates:
7072
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
71-
return utils.parse_messages(
73+
return pyrogram.Message.parse(
7274
self, i.message,
7375
{i.id: i for i in r.users},
7476
{i.id: i for i in r.chats}

pyrogram/client/methods/messages/edit_message_media.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import os
2222
import struct
2323

24+
import pyrogram
2425
from pyrogram.api import functions, types
2526
from pyrogram.api.errors import FileIdInvalid
2627
from pyrogram.client.ext import BaseClient, utils
@@ -333,7 +334,7 @@ def edit_message_media(self,
333334

334335
for i in r.updates:
335336
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
336-
return utils.parse_messages(
337+
return pyrogram.Message.parse(
337338
self, i.message,
338339
{i.id: i for i in r.users},
339340
{i.id: i for i in r.chats}

pyrogram/client/methods/messages/edit_message_reply_markup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
import pyrogram
1920
from pyrogram.api import functions, types
20-
from pyrogram.client.ext import BaseClient, utils
21+
from pyrogram.client.ext import BaseClient
2122

2223

2324
class EditMessageReplyMarkup(BaseClient):
@@ -57,7 +58,7 @@ def edit_message_reply_markup(self,
5758

5859
for i in r.updates:
5960
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
60-
return utils.parse_messages(
61+
return pyrogram.Message.parse(
6162
self, i.message,
6263
{i.id: i for i in r.users},
6364
{i.id: i for i in r.chats}

pyrogram/client/methods/messages/edit_message_text.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
import pyrogram
1920
from pyrogram.api import functions, types
20-
from pyrogram.client.ext import BaseClient, utils
21+
from pyrogram.client.ext import BaseClient
2122

2223

2324
class EditMessageText(BaseClient):
@@ -73,7 +74,7 @@ def edit_message_text(self,
7374

7475
for i in r.updates:
7576
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
76-
return utils.parse_messages(
77+
return pyrogram.Message.parse(
7778
self, i.message,
7879
{i.id: i for i in r.users},
7980
{i.id: i for i in r.chats}

pyrogram/client/methods/messages/forward_messages.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
import pyrogram
1920
from pyrogram.api import functions, types
20-
from ...ext import BaseClient, utils
21+
from ...ext import BaseClient
2122

2223

2324
class ForwardMessages(BaseClient):
@@ -77,7 +78,7 @@ def forward_messages(self,
7778
for i in r.updates:
7879
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
7980
messages.append(
80-
utils.parse_messages(
81+
pyrogram.Message.parse(
8182
self, i.message,
8283
users, chats
8384
)

pyrogram/client/methods/messages/get_messages.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
import pyrogram
1920
from pyrogram.api import functions, types
20-
from ...ext import BaseClient, utils
21+
from ...ext import BaseClient
2122

2223

2324
class GetMessages(BaseClient):
@@ -48,10 +49,9 @@ def get_messages(self,
4849
The number of subsequent replies to get for each message. Defaults to 1.
4950
5051
Returns:
51-
On success and in case *message_ids* or *reply_to_message_ids* was a list, the returned value will be a
52-
list of the requested :obj:`Messages <pyrogram.Messages>` even if a list contains just one element,
53-
otherwise if *message_ids* or *reply_to_message_ids* was an integer, the single requested
54-
:obj:`Message <pyrogram.Message>` is returned.
52+
On success and in case *message_ids* or *reply_to_message_ids* was an iterable, the returned value will be a
53+
:obj:`Messages <pyrogram.Messages>` even if a list contains just one element. Otherwise, if *message_ids* or
54+
*reply_to_message_ids* was an integer, the single requested :obj:`Message <pyrogram.Message>` is returned.
5555
5656
Raises:
5757
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
@@ -76,13 +76,6 @@ def get_messages(self,
7676
else:
7777
rpc = functions.messages.GetMessages(id=ids)
7878

79-
r = self.send(rpc)
79+
messages = pyrogram.Messages.parse(self, self.send(rpc))
8080

81-
messages = utils.parse_messages(
82-
self, r.messages,
83-
{i.id: i for i in r.users},
84-
{i.id: i for i in r.chats},
85-
replies=replies
86-
)
87-
88-
return messages if is_iterable else messages[0]
81+
return messages if is_iterable else messages.messages[0]

pyrogram/client/methods/messages/send_animation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import os
2222
import struct
2323

24+
import pyrogram
2425
from pyrogram.api import functions, types
2526
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
2627
from pyrogram.client.ext import BaseClient, utils
@@ -184,7 +185,7 @@ def send_animation(self,
184185
else:
185186
for i in r.updates:
186187
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
187-
return utils.parse_messages(
188+
return pyrogram.Message.parse(
188189
self, i.message,
189190
{i.id: i for i in r.users},
190191
{i.id: i for i in r.chats}

pyrogram/client/methods/messages/send_audio.py

Lines changed: 2 additions & 1 deletion

0 commit comments

Comments
 (0)