Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion telegram/ext/conversationhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def check_update(self, update):
# Ignore messages in channels
if (not isinstance(update, Update) or update.channel_post or self.per_chat
and (update.inline_query or update.chosen_inline_result) or self.per_message
and not update.callback_query):
and not update.callback_query or update.callback_query and self.per_chat
and not update.callback_query.message):
return False

key = self._get_key(update)
Expand Down
8 changes: 8 additions & 0 deletions tests/test_conversationhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ def test_endOnFirstMessageAsync(self):
# Assert that the Promise has been resolved and the conversation ended.
self.assertEquals(len(handler.conversations), 0)

def test_perChatMessageWithoutChat(self):
handler = ConversationHandler(
entry_points=[CommandHandler('start', self.start_end)], states={}, fallbacks=[])
user = User(first_name="Misses Test", id=123)
cbq = CallbackQuery(0, user, None, None)
update = Update(0, callback_query=cbq)
handler.check_update(update)


if __name__ == '__main__':
unittest.main()