2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Make send_message return the correct Message type

This commit is contained in:
Dan 2018-04-30 13:13:30 +02:00
parent e2224054d2
commit deed74840a

View File

@ -262,7 +262,7 @@ class Client:
return func
return decorator
# TODO: Maybe make add_handler return (handler, group)?
def add_handler(self, handler, group: int = 0):
"""Use this method to register an update handler.
@ -1154,7 +1154,7 @@ class Client:
"""
style = self.html if parse_mode.lower() == "html" else self.markdown
return self.send(
r = self.send(
functions.messages.SendMessage(
peer=self.resolve_peer(chat_id),
no_webpage=disable_web_page_preview or None,
@ -1166,6 +1166,21 @@ class Client:
)
)
if isinstance(r, types.UpdateShortSentMessage):
return pyrogram_types.Message(
message_id=r.id,
date=r.date,
outgoing=r.out,
entities=utils.parse_entities(r.entities, {}) or None
)
for i in r.updates:
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
users = {i.id: i for i in r.users}
chats = {i.id: i for i in r.chats}
return utils.parse_message(self, i.message, users, chats)
def forward_messages(self,
chat_id: int or str,
from_chat_id: int or str,