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

Fix inline_query_handler not work.

This commit is contained in:
eternnoir 2017-11-15 00:42:27 +08:00
parent 47624a556e
commit 7ac246b801
2 changed files with 8 additions and 7 deletions

View File

@ -1260,12 +1260,12 @@ class TeleBot:
def _notify_command_handlers(self, handlers, new_messages):
for message in new_messages:
# if message has next step handler, dont exec command handlers
if (isinstance(message, types.CallbackQuery)) or \
(isinstance(message, types.Message) and (message.chat.id not in self.message_subscribers_next_step)):
for message_handler in handlers:
if self._test_message_handler(message_handler, message):
self._exec_task(message_handler['function'], message)
break
if hasattr(message, 'chat') and message.chat and (message.chat.id in self.message_subscribers_next_step):
continue
for message_handler in handlers:
if self._test_message_handler(message_handler, message):
self._exec_task(message_handler['function'], message)
break
class AsyncTeleBot(TeleBot):

View File

@ -201,7 +201,8 @@ class TestTeleBot:
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, performer='eternnoir', title='pyTelegram', disable_notification=True)
ret_msg = tb.send_audio(CHAT_ID, file_data, 1, performer='eternnoir', title='pyTelegram',
disable_notification=True)
assert ret_msg.content_type == 'audio'
assert ret_msg.audio.performer == 'eternnoir'
assert ret_msg.audio.title == 'pyTelegram'