Reformat code

This commit is contained in:
Dan 2017-12-07 02:02:16 +01:00
parent 5c11f42933
commit 500c88ae84
2 changed files with 14 additions and 9 deletions

View File

@ -397,19 +397,14 @@ class Client:
disable_web_page_preview: bool = None,
disable_notification: bool = None,
reply_to_msg_id: int = None):
# TODO: Resolve usernames when they don't exists yet (contacts.ResolveUsername)
text, entities = Markdown.parse(text)
return self.send(
functions.messages.SendMessage(
peer=self.resolve_peer(chat_id),
message=text,
no_webpage=disable_web_page_preview or None,
silent=disable_notification or None,
reply_to_msg_id=reply_to_msg_id,
entities=entities,
random_id=self.rnd_id(),
**Markdown.parse(text)
)
)
@ -470,7 +465,10 @@ class Client:
)
)
def send_chat_action(self, chat_id: int or str, action: str, progress: int = 0):
def send_chat_action(self,
chat_id: int or str,
action: str,
progress: int = 0):
return self.send(
functions.messages.SetTyping(
peer=self.resolve_peer(chat_id),
@ -480,7 +478,11 @@ class Client:
)
)
def edit_message_text(self, chat_id: int or str, message_id: int, text: str, disable_web_page_preview: bool = None):
def edit_message_text(self,
chat_id: int or str,
message_id: int,
text: str,
disable_web_page_preview: bool = None):
return self.send(
functions.messages.EditMessage(
peer=self.resolve_peer(chat_id),

View File

@ -117,4 +117,7 @@ class Markdown:
entities.append(entity)
text = text.replace(pattern, replace)
return cls.remove_surrogates(text), entities
return dict(
message=cls.remove_surrogates(text),
entities=entities
)