1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #120 from eternnoir/feature-disable_notification

Feature disable notification
This commit is contained in:
FrankWang 2016-02-27 11:45:23 +08:00
commit 3d9e012c40
3 changed files with 148 additions and 32 deletions

View File

@ -11,7 +11,7 @@ import logging
logger = logging.getLogger('TeleBot') logger = logging.getLogger('TeleBot')
formatter = logging.Formatter( formatter = logging.Formatter(
'%(asctime)s (%(filename)s:%(lineno)d %(threadName)s) %(levelname)s - %(name)s: "%(message)s"' '%(asctime)s (%(filename)s:%(lineno)d %(threadName)s) %(levelname)s - %(name)s: "%(message)s"'
) )
console_output_handler = logging.StreamHandler(sys.stderr) console_output_handler = logging.StreamHandler(sys.stderr)
@ -182,9 +182,9 @@ class TeleBot:
polling_thread = util.WorkerThread(name="PollingThread") polling_thread = util.WorkerThread(name="PollingThread")
or_event = util.OrEvent( or_event = util.OrEvent(
polling_thread.done_event, polling_thread.done_event,
polling_thread.exception_event, polling_thread.exception_event,
self.worker_pool.exception_event self.worker_pool.exception_event
) )
while not self.__stop_polling.wait(interval): while not self.__stop_polling.wait(interval):
@ -277,7 +277,7 @@ class TeleBot:
return types.UserProfilePhotos.de_json(result) return types.UserProfilePhotos.de_json(result)
def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None, def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None): parse_mode=None, disable_notification=None):
""" """
Use this method to send text messages. Use this method to send text messages.
@ -290,23 +290,27 @@ class TeleBot:
:param reply_to_message_id: :param reply_to_message_id:
:param reply_markup: :param reply_markup:
:param parse_mode: :param parse_mode:
:param disable_notification: Boolean, Optional. Sends the message silently.
:return: API reply. :return: API reply.
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_message(self.token, chat_id, text, disable_web_page_preview, reply_to_message_id, apihelper.send_message(self.token, chat_id, text, disable_web_page_preview, reply_to_message_id,
reply_markup, parse_mode)) reply_markup, parse_mode, disable_notification))
def forward_message(self, chat_id, from_chat_id, message_id): def forward_message(self, chat_id, from_chat_id, message_id, disable_notification=None):
""" """
Use this method to forward messages of any kind. Use this method to forward messages of any kind.
:param disable_notification:
:param chat_id: which chat to forward :param chat_id: which chat to forward
:param from_chat_id: which chat message from :param from_chat_id: which chat message from
:param message_id: message id :param message_id: message id
:return: API reply. :return: API reply.
""" """
return types.Message.de_json(apihelper.forward_message(self.token, chat_id, from_chat_id, message_id)) return types.Message.de_json(
apihelper.forward_message(self.token, chat_id, from_chat_id, message_id, disable_notification))
def send_photo(self, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None): def send_photo(self, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
""" """
Use this method to send photos. Use this method to send photos.
:param chat_id: :param chat_id:
@ -317,10 +321,11 @@ class TeleBot:
:return: API reply. :return: API reply.
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_photo(self.token, chat_id, photo, caption, reply_to_message_id, reply_markup)) apihelper.send_photo(self.token, chat_id, photo, caption, reply_to_message_id, reply_markup,
disable_notification))
def send_audio(self, chat_id, audio, duration=None, performer=None, title=None, reply_to_message_id=None, def send_audio(self, chat_id, audio, duration=None, performer=None, title=None, reply_to_message_id=None,
reply_markup=None): reply_markup=None, disable_notification=None):
""" """
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format.
:param chat_id:Unique identifier for the message recipient :param chat_id:Unique identifier for the message recipient
@ -333,10 +338,11 @@ class TeleBot:
:return: Message :return: Message
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_audio(self.token, chat_id, audio, duration, performer, title, reply_to_message_id, apihelper.send_audio(self.token, chat_id, audio, duration, performer, title, reply_to_message_id,
reply_markup)) reply_markup, disable_notification))
def send_voice(self, chat_id, voice, duration=None, reply_to_message_id=None, reply_markup=None): def send_voice(self, chat_id, voice, duration=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
""" """
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
:param chat_id:Unique identifier for the message recipient. :param chat_id:Unique identifier for the message recipient.
@ -347,9 +353,10 @@ class TeleBot:
:return: Message :return: Message
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_voice(self.token, chat_id, voice, duration, reply_to_message_id, reply_markup)) apihelper.send_voice(self.token, chat_id, voice, duration, reply_to_message_id, reply_markup,
disable_notification))
def send_document(self, chat_id, data, reply_to_message_id=None, reply_markup=None): def send_document(self, chat_id, data, reply_to_message_id=None, reply_markup=None, disable_notification=None):
""" """
Use this method to send general files. Use this method to send general files.
:param chat_id: :param chat_id:
@ -359,9 +366,10 @@ class TeleBot:
:return: API reply. :return: API reply.
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_data(self.token, chat_id, data, 'document', reply_to_message_id, reply_markup)) apihelper.send_data(self.token, chat_id, data, 'document', reply_to_message_id, reply_markup,
disable_notification))
def send_sticker(self, chat_id, data, reply_to_message_id=None, reply_markup=None): def send_sticker(self, chat_id, data, reply_to_message_id=None, reply_markup=None, disable_notification=None):
""" """
Use this method to send .webp stickers. Use this method to send .webp stickers.
:param chat_id: :param chat_id:
@ -371,9 +379,11 @@ class TeleBot:
:return: API reply. :return: API reply.
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_data(self.token, chat_id, data, 'sticker', reply_to_message_id, reply_markup)) apihelper.send_data(self.token, chat_id, data, 'sticker', reply_to_message_id, reply_markup,
disable_notification))
def send_video(self, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None): def send_video(self, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
""" """
Use this method to send video files, Telegram clients support mp4 videos. Use this method to send video files, Telegram clients support mp4 videos.
:param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id :param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id
@ -385,9 +395,11 @@ class TeleBot:
:return: :return:
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_video(self.token, chat_id, data, duration, caption, reply_to_message_id, reply_markup)) apihelper.send_video(self.token, chat_id, data, duration, caption, reply_to_message_id, reply_markup,
disable_notification))
def send_location(self, chat_id, latitude, longitude, reply_to_message_id=None, reply_markup=None): def send_location(self, chat_id, latitude, longitude, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
""" """
Use this method to send point on the map. Use this method to send point on the map.
:param chat_id: :param chat_id:
@ -398,7 +410,8 @@ class TeleBot:
:return: API reply. :return: API reply.
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_location(self.token, chat_id, latitude, longitude, reply_to_message_id, reply_markup)) apihelper.send_location(self.token, chat_id, latitude, longitude, reply_to_message_id, reply_markup,
disable_notification))
def send_chat_action(self, chat_id, action): def send_chat_action(self, chat_id, action):
""" """

View File

@ -81,7 +81,7 @@ def download_file(token, file_path):
def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None, def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None): parse_mode=None, disable_notification=None):
""" """
Use this method to send text messages. On success, the sent Message is returned. Use this method to send text messages. On success, the sent Message is returned.
:param token: :param token:
@ -102,6 +102,8 @@ def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_m
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if parse_mode: if parse_mode:
payload['parse_mode'] = parse_mode payload['parse_mode'] = parse_mode
if disable_notification:
payload['disable_notification'] = disable_notification
return _make_request(token, method_url, params=payload, method='post') return _make_request(token, method_url, params=payload, method='post')
@ -139,13 +141,16 @@ def get_user_profile_photos(token, user_id, offset=None, limit=None):
return _make_request(token, method_url, params=payload) return _make_request(token, method_url, params=payload)
def forward_message(token, chat_id, from_chat_id, message_id): def forward_message(token, chat_id, from_chat_id, message_id, disable_notification=None):
method_url = r'forwardMessage' method_url = r'forwardMessage'
payload = {'chat_id': chat_id, 'from_chat_id': from_chat_id, 'message_id': message_id} payload = {'chat_id': chat_id, 'from_chat_id': from_chat_id, 'message_id': message_id}
if disable_notification:
payload['disable_notification'] = disable_notification
return _make_request(token, method_url, params=payload) return _make_request(token, method_url, params=payload)
def send_photo(token, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None): def send_photo(token, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
method_url = r'sendPhoto' method_url = r'sendPhoto'
payload = {'chat_id': chat_id} payload = {'chat_id': chat_id}
files = None files = None
@ -159,16 +164,21 @@ def send_photo(token, chat_id, photo, caption=None, reply_to_message_id=None, re
payload['reply_to_message_id'] = reply_to_message_id payload['reply_to_message_id'] = reply_to_message_id
if reply_markup: if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if disable_notification:
payload['disable_notification'] = disable_notification
return _make_request(token, method_url, params=payload, files=files, method='post') return _make_request(token, method_url, params=payload, files=files, method='post')
def send_location(token, chat_id, latitude, longitude, reply_to_message_id=None, reply_markup=None): def send_location(token, chat_id, latitude, longitude, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
method_url = r'sendLocation' method_url = r'sendLocation'
payload = {'chat_id': chat_id, 'latitude': latitude, 'longitude': longitude} payload = {'chat_id': chat_id, 'latitude': latitude, 'longitude': longitude}
if reply_to_message_id: if reply_to_message_id:
payload['reply_to_message_id'] = reply_to_message_id payload['reply_to_message_id'] = reply_to_message_id
if reply_markup: if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if disable_notification:
payload['disable_notification'] = disable_notification
return _make_request(token, method_url, params=payload) return _make_request(token, method_url, params=payload)
@ -178,7 +188,8 @@ def send_chat_action(token, chat_id, action):
return _make_request(token, method_url, params=payload) return _make_request(token, method_url, params=payload)
def send_video(token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None): def send_video(token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
method_url = r'sendVideo' method_url = r'sendVideo'
payload = {'chat_id': chat_id} payload = {'chat_id': chat_id}
files = None files = None
@ -194,10 +205,13 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa
payload['reply_to_message_id'] = reply_to_message_id payload['reply_to_message_id'] = reply_to_message_id
if reply_markup: if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if disable_notification:
payload['disable_notification'] = disable_notification
return _make_request(token, method_url, params=payload, files=files, method='post') return _make_request(token, method_url, params=payload, files=files, method='post')
def send_voice(token, chat_id, voice, duration=None, reply_to_message_id=None, reply_markup=None): def send_voice(token, chat_id, voice, duration=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
method_url = r'sendVoice' method_url = r'sendVoice'
payload = {'chat_id': chat_id} payload = {'chat_id': chat_id}
files = None files = None
@ -211,11 +225,13 @@ def send_voice(token, chat_id, voice, duration=None, reply_to_message_id=None, r
payload['reply_to_message_id'] = reply_to_message_id payload['reply_to_message_id'] = reply_to_message_id
if reply_markup: if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if disable_notification:
payload['disable_notification'] = disable_notification
return _make_request(token, method_url, params=payload, files=files, method='post') return _make_request(token, method_url, params=payload, files=files, method='post')
def send_audio(token, chat_id, audio, duration=None, performer=None, title=None, reply_to_message_id=None, def send_audio(token, chat_id, audio, duration=None, performer=None, title=None, reply_to_message_id=None,
reply_markup=None): reply_markup=None, disable_notification=None):
method_url = r'sendAudio' method_url = r'sendAudio'
payload = {'chat_id': chat_id} payload = {'chat_id': chat_id}
files = None files = None
@ -233,10 +249,12 @@ def send_audio(token, chat_id, audio, duration=None, performer=None, title=None,
payload['reply_to_message_id'] = reply_to_message_id payload['reply_to_message_id'] = reply_to_message_id
if reply_markup: if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if disable_notification:
payload['disable_notification'] = disable_notification
return _make_request(token, method_url, params=payload, files=files, method='post') return _make_request(token, method_url, params=payload, files=files, method='post')
def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None): def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None, disable_notification=None):
method_url = get_method_by_type(data_type) method_url = get_method_by_type(data_type)
payload = {'chat_id': chat_id} payload = {'chat_id': chat_id}
files = None files = None
@ -248,6 +266,8 @@ def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_m
payload['reply_to_message_id'] = reply_to_message_id payload['reply_to_message_id'] = reply_to_message_id
if reply_markup: if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if disable_notification:
payload['disable_notification'] = disable_notification
return _make_request(token, method_url, params=payload, files=files, method='post') return _make_request(token, method_url, params=payload, files=files, method='post')

View File

@ -101,6 +101,16 @@ class TestTeleBot:
ret_msg = tb.send_message(CHAT_ID, markdown, parse_mode="Markdown") ret_msg = tb.send_message(CHAT_ID, markdown, parse_mode="Markdown")
assert ret_msg.message_id assert ret_msg.message_id
def test_send_message_with_disable_notification(self):
tb = telebot.TeleBot(TOKEN)
markdown = """
*bold text*
_italic text_
[text](URL)
"""
ret_msg = tb.send_message(CHAT_ID, markdown, parse_mode="Markdown", disable_notification=True)
assert ret_msg.message_id
def test_send_file(self): def test_send_file(self):
file_data = open('../examples/detailed_example/kitten.jpg', 'rb') file_data = open('../examples/detailed_example/kitten.jpg', 'rb')
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
@ -110,18 +120,39 @@ class TestTeleBot:
ret_msg = tb.send_document(CHAT_ID, ret_msg.document.file_id) ret_msg = tb.send_document(CHAT_ID, ret_msg.document.file_id)
assert ret_msg.message_id assert ret_msg.message_id
def test_send_file_dis_noti(self):
file_data = open('../examples/detailed_example/kitten.jpg', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_document(CHAT_ID, file_data, disable_notification=True)
assert ret_msg.message_id
ret_msg = tb.send_document(CHAT_ID, ret_msg.document.file_id)
assert ret_msg.message_id
def test_send_video(self): def test_send_video(self):
file_data = open('./test_data/test_video.mp4', 'rb') file_data = open('./test_data/test_video.mp4', 'rb')
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_video(CHAT_ID, file_data) ret_msg = tb.send_video(CHAT_ID, file_data)
assert ret_msg.message_id assert ret_msg.message_id
def test_send_video_dis_noti(self):
file_data = open('./test_data/test_video.mp4', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_video(CHAT_ID, file_data, disable_notification=True)
assert ret_msg.message_id
def test_send_video_more_params(self): def test_send_video_more_params(self):
file_data = open('./test_data/test_video.mp4', 'rb') file_data = open('./test_data/test_video.mp4', 'rb')
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_video(CHAT_ID, file_data, 1) ret_msg = tb.send_video(CHAT_ID, file_data, 1)
assert ret_msg.message_id assert ret_msg.message_id
def test_send_video_more_params_dis_noti(self):
file_data = open('./test_data/test_video.mp4', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_video(CHAT_ID, file_data, 1, disable_notification=True)
assert ret_msg.message_id
def test_send_file_exception(self): def test_send_file_exception(self):
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
try: try:
@ -140,6 +171,15 @@ class TestTeleBot:
ret_msg = tb.send_photo(CHAT_ID, ret_msg.photo[0].file_id) ret_msg = tb.send_photo(CHAT_ID, ret_msg.photo[0].file_id)
assert ret_msg.message_id assert ret_msg.message_id
def test_send_photo_dis_noti(self):
file_data = open('../examples/detailed_example/kitten.jpg', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_photo(CHAT_ID, file_data)
assert ret_msg.message_id
ret_msg = tb.send_photo(CHAT_ID, ret_msg.photo[0].file_id, disable_notification=True)
assert ret_msg.message_id
def test_send_audio(self): def test_send_audio(self):
file_data = open('./test_data/record.mp3', 'rb') file_data = open('./test_data/record.mp3', 'rb')
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
@ -148,12 +188,26 @@ class TestTeleBot:
assert ret_msg.audio.performer == 'eternnoir' assert ret_msg.audio.performer == 'eternnoir'
assert ret_msg.audio.title == 'pyTelegram' assert ret_msg.audio.title == 'pyTelegram'
def test_send_audio_dis_noti(self):
file_data = open('./test_data/record.mp3', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_audio(CHAT_ID, file_data, 1, 'eternnoir', 'pyTelegram', disable_notification=True)
assert ret_msg.content_type == 'audio'
assert ret_msg.audio.performer == 'eternnoir'
assert ret_msg.audio.title == 'pyTelegram'
def test_send_voice(self): def test_send_voice(self):
file_data = open('./test_data/record.ogg', 'rb') file_data = open('./test_data/record.ogg', 'rb')
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_voice(CHAT_ID, file_data) ret_msg = tb.send_voice(CHAT_ID, file_data)
assert ret_msg.voice.mime_type == 'audio/ogg' assert ret_msg.voice.mime_type == 'audio/ogg'
def test_send_voice_dis_noti(self):
file_data = open('./test_data/record.ogg', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_voice(CHAT_ID, file_data, disable_notification=True)
assert ret_msg.voice.mime_type == 'audio/ogg'
def test_get_file(self): def test_get_file(self):
file_data = open('./test_data/record.ogg', 'rb') file_data = open('./test_data/record.ogg', 'rb')
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
@ -162,12 +216,26 @@ class TestTeleBot:
file_info = tb.get_file(file_id) file_info = tb.get_file(file_id)
assert file_info.file_id == file_id assert file_info.file_id == file_id
def test_get_file_dis_noti(self):
file_data = open('./test_data/record.ogg', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_voice(CHAT_ID, file_data, disable_notification=True)
file_id = ret_msg.voice.file_id
file_info = tb.get_file(file_id)
assert file_info.file_id == file_id
def test_send_message(self): def test_send_message(self):
text = 'CI Test Message' text = 'CI Test Message'
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_message(CHAT_ID, text) ret_msg = tb.send_message(CHAT_ID, text)
assert ret_msg.message_id assert ret_msg.message_id
def test_send_message_dis_noti(self):
text = 'CI Test Message'
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_message(CHAT_ID, text, disable_notification=True)
assert ret_msg.message_id
def test_forward_message(self): def test_forward_message(self):
text = 'CI forward_message Test Message' text = 'CI forward_message Test Message'
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
@ -175,6 +243,13 @@ class TestTeleBot:
ret_msg = tb.forward_message(CHAT_ID, CHAT_ID, msg.message_id) ret_msg = tb.forward_message(CHAT_ID, CHAT_ID, msg.message_id)
assert ret_msg.forward_from assert ret_msg.forward_from
def test_forward_message_dis_noti(self):
text = 'CI forward_message Test Message'
tb = telebot.TeleBot(TOKEN)
msg = tb.send_message(CHAT_ID, text)
ret_msg = tb.forward_message(CHAT_ID, CHAT_ID, msg.message_id, disable_notification=True)
assert ret_msg.forward_from
def test_reply_to(self): def test_reply_to(self):
text = 'CI reply_to Test Message' text = 'CI reply_to Test Message'
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
@ -203,6 +278,14 @@ class TestTeleBot:
assert int(ret_msg.location.longitude) == int(lon) assert int(ret_msg.location.longitude) == int(lon)
assert int(ret_msg.location.latitude) == int(lat) assert int(ret_msg.location.latitude) == int(lat)
def test_send_location_dis_noti(self):
tb = telebot.TeleBot(TOKEN)
lat = 26.3875591
lon = -161.2901042
ret_msg = tb.send_location(CHAT_ID, lat, lon, disable_notification=True)
assert int(ret_msg.location.longitude) == int(lon)
assert int(ret_msg.location.latitude) == int(lat)
def test_Chat(self): def test_Chat(self):
tb = telebot.TeleBot(TOKEN) tb = telebot.TeleBot(TOKEN)
me = tb.get_me() me = tb.get_me()