Commit c699cf23 authored by Zeitpunk's avatar Zeitpunk 💬

[F] Added parse_mode argument for sendMessage

parent 7e8a7616
......@@ -59,12 +59,17 @@ class telefly:
self.getUrl(url)
""" sends text to chat_id """
def sendMessage(self, text, chat_id, disable_notification=None, reply_markup=None):
""" sends text to chat_id
parse_mode:
'Markdown' or 'HTML'
"""
def sendMessage(self, text, chat_id, disable_notification=None, parse_mode=None, reply_markup=None):
text = urllib.parse.quote_plus(text) # encode any special characters in our message to be url-friendly, for example the + sign
url = self.URL + "sendMessage?text={}&chat_id={}&parse_mode=Markdown".format(text, chat_id)
if disable_notification:
url += "&disable_notification={}".format(disable_notification)
if parse_mode:
url += "&parse_mode={}".format(parse_mode)
if reply_markup:
url += "&reply_markup={}".format(reply_markup)
self.getUrl(url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment