mirror of
https://github.com/pyrogram/pyrogram
synced 2025-09-01 23:05:15 +00:00
Fix all those unresolved references caused by the refactor
This commit is contained in:
@@ -16,9 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.api import functions, types
|
|
||||||
from ...ext import BaseClient, utils
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
|
from pyrogram.api import functions, types
|
||||||
|
from ...ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class Filters:
|
class Filters:
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.client.ext import utils
|
|
||||||
from ...ext import BaseClient
|
from ...ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ class KickChatMember(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,8 +16,10 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
|
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class EditMessageCaption(BaseClient):
|
class EditMessageCaption(BaseClient):
|
||||||
@@ -68,7 +70,7 @@ class EditMessageCaption(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -21,6 +21,7 @@ import mimetypes
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid
|
from pyrogram.api.errors import FileIdInvalid
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -333,7 +334,7 @@ class EditMessageMedia(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class EditMessageReplyMarkup(BaseClient):
|
class EditMessageReplyMarkup(BaseClient):
|
||||||
@@ -57,7 +58,7 @@ class EditMessageReplyMarkup(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class EditMessageText(BaseClient):
|
class EditMessageText(BaseClient):
|
||||||
@@ -73,7 +74,7 @@ class EditMessageText(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from ...ext import BaseClient, utils
|
from ...ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class ForwardMessages(BaseClient):
|
class ForwardMessages(BaseClient):
|
||||||
@@ -77,7 +78,7 @@ class ForwardMessages(BaseClient):
|
|||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
messages.append(
|
messages.append(
|
||||||
utils.parse_messages(
|
pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
users, chats
|
users, chats
|
||||||
)
|
)
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from ...ext import BaseClient, utils
|
from ...ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class GetMessages(BaseClient):
|
class GetMessages(BaseClient):
|
||||||
@@ -48,10 +49,9 @@ class GetMessages(BaseClient):
|
|||||||
The number of subsequent replies to get for each message. Defaults to 1.
|
The number of subsequent replies to get for each message. Defaults to 1.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success and in case *message_ids* or *reply_to_message_ids* was a list, the returned value will be a
|
On success and in case *message_ids* or *reply_to_message_ids* was an iterable, the returned value will be a
|
||||||
list of the requested :obj:`Messages <pyrogram.Messages>` even if a list contains just one element,
|
:obj:`Messages <pyrogram.Messages>` even if a list contains just one element. Otherwise, if *message_ids* or
|
||||||
otherwise if *message_ids* or *reply_to_message_ids* was an integer, the single requested
|
*reply_to_message_ids* was an integer, the single requested :obj:`Message <pyrogram.Message>` is returned.
|
||||||
:obj:`Message <pyrogram.Message>` is returned.
|
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
|
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
|
||||||
@@ -76,13 +76,6 @@ class GetMessages(BaseClient):
|
|||||||
else:
|
else:
|
||||||
rpc = functions.messages.GetMessages(id=ids)
|
rpc = functions.messages.GetMessages(id=ids)
|
||||||
|
|
||||||
r = self.send(rpc)
|
messages = pyrogram.Messages.parse(self, self.send(rpc))
|
||||||
|
|
||||||
messages = utils.parse_messages(
|
return messages if is_iterable else messages.messages[0]
|
||||||
self, r.messages,
|
|
||||||
{i.id: i for i in r.users},
|
|
||||||
{i.id: i for i in r.chats},
|
|
||||||
replies=replies
|
|
||||||
)
|
|
||||||
|
|
||||||
return messages if is_iterable else messages[0]
|
|
||||||
|
@@ -21,6 +21,7 @@ import mimetypes
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -184,7 +185,7 @@ class SendAnimation(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -21,6 +21,7 @@ import mimetypes
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -184,7 +185,7 @@ class SendAudio(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class SendContact(BaseClient):
|
class SendContact(BaseClient):
|
||||||
@@ -86,7 +87,7 @@ class SendContact(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -21,6 +21,7 @@ import mimetypes
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -165,7 +166,7 @@ class SendDocument(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class SendLocation(BaseClient):
|
class SendLocation(BaseClient):
|
||||||
@@ -78,7 +79,7 @@ class SendLocation(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.client import types as pyrogram_types
|
from ...ext import BaseClient
|
||||||
from ...ext import utils, BaseClient
|
|
||||||
|
|
||||||
|
|
||||||
class SendMessage(BaseClient):
|
class SendMessage(BaseClient):
|
||||||
@@ -83,9 +83,13 @@ class SendMessage(BaseClient):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if isinstance(r, types.UpdateShortSentMessage):
|
if isinstance(r, types.UpdateShortSentMessage):
|
||||||
return pyrogram_types.Message(
|
return pyrogram.Message(
|
||||||
message_id=r.id,
|
message_id=r.id,
|
||||||
chat=pyrogram_types.Chat(id=list(self.resolve_peer(chat_id).__dict__.values())[0], type="private"),
|
chat=pyrogram.Chat(
|
||||||
|
id=list(self.resolve_peer(chat_id).__dict__.values())[0],
|
||||||
|
type="private",
|
||||||
|
client=self
|
||||||
|
),
|
||||||
text=message,
|
text=message,
|
||||||
date=r.date,
|
date=r.date,
|
||||||
outgoing=r.out,
|
outgoing=r.out,
|
||||||
@@ -95,7 +99,7 @@ class SendMessage(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -20,6 +20,7 @@ import binascii
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -160,7 +161,7 @@ class SendPhoto(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -20,6 +20,7 @@ import binascii
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -144,7 +145,7 @@ class SendSticker(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class SendVenue(BaseClient):
|
class SendVenue(BaseClient):
|
||||||
@@ -100,7 +101,7 @@ class SendVenue(BaseClient):
|
|||||||
|
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -21,6 +21,7 @@ import mimetypes
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -187,7 +188,7 @@ class SendVideo(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -21,6 +21,7 @@ import mimetypes
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -163,7 +164,7 @@ class SendVideoNote(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -21,6 +21,7 @@ import mimetypes
|
|||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
from pyrogram.api.errors import FileIdInvalid, FilePartMissing
|
||||||
from pyrogram.client.ext import BaseClient, utils
|
from pyrogram.client.ext import BaseClient, utils
|
||||||
@@ -163,7 +164,7 @@ class SendVoice(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return utils.parse_messages(
|
return pyrogram.Message.parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from ...ext import BaseClient, utils
|
from ...ext import BaseClient
|
||||||
|
|
||||||
|
|
||||||
class GetMe(BaseClient):
|
class GetMe(BaseClient):
|
||||||
@@ -30,7 +31,8 @@ class GetMe(BaseClient):
|
|||||||
Raises:
|
Raises:
|
||||||
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
|
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
return utils.parse_user(
|
return pyrogram.User.parse(
|
||||||
|
self,
|
||||||
self.send(
|
self.send(
|
||||||
functions.users.GetFullUser(
|
functions.users.GetFullUser(
|
||||||
types.InputPeerSelf()
|
types.InputPeerSelf()
|
||||||
|
@@ -84,7 +84,8 @@ class DownloadMedia(BaseClient):
|
|||||||
file_id=message.photo.sizes[-1].file_id,
|
file_id=message.photo.sizes[-1].file_id,
|
||||||
file_size=message.photo.sizes[-1].file_size,
|
file_size=message.photo.sizes[-1].file_size,
|
||||||
mime_type="",
|
mime_type="",
|
||||||
date=message.photo.date
|
date=message.photo.date,
|
||||||
|
client=self
|
||||||
)
|
)
|
||||||
elif message.audio:
|
elif message.audio:
|
||||||
media = message.audio
|
media = message.audio
|
||||||
@@ -118,7 +119,8 @@ class DownloadMedia(BaseClient):
|
|||||||
file_id=message.sizes[-1].file_id,
|
file_id=message.sizes[-1].file_id,
|
||||||
file_size=message.sizes[-1].file_size,
|
file_size=message.sizes[-1].file_size,
|
||||||
mime_type="",
|
mime_type="",
|
||||||
date=message.date
|
date=message.date,
|
||||||
|
client=self
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
media = message
|
media = message
|
||||||
@@ -126,7 +128,8 @@ class DownloadMedia(BaseClient):
|
|||||||
media = pyrogram_types.Document(
|
media = pyrogram_types.Document(
|
||||||
file_id=message,
|
file_id=message,
|
||||||
file_size=0,
|
file_size=0,
|
||||||
mime_type=""
|
mime_type="",
|
||||||
|
client=self
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise ValueError(error_message)
|
raise ValueError(error_message)
|
||||||
|
Reference in New Issue
Block a user