From 6a011648971c43e9d280b833d77fb857ca837f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joscha=20G=C3=B6tzer?= Date: Sun, 25 Dec 2016 21:36:01 +0100 Subject: [PATCH] ConversationHandler breaks when bot is also used in Channels (#487) * ConversationHandler now ignores channel posts --- AUTHORS.rst | 1 + telegram/ext/conversationhandler.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 31b1c361e..1d56ca8fd 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -32,6 +32,7 @@ The following wonderful people contributed directly or indirectly to this projec - `overquota `_ - `Patrick Hofmann `_ - `Rahiel Kasim `_ +- `Joscha Götzer `_ - `Shelomentsev D `_ - `sooyhwang `_ - `Valentijn `_ diff --git a/telegram/ext/conversationhandler.py b/telegram/ext/conversationhandler.py index 387ae296f..685b4394a 100644 --- a/telegram/ext/conversationhandler.py +++ b/telegram/ext/conversationhandler.py @@ -28,7 +28,9 @@ from telegram.utils.promise import Promise class ConversationHandler(Handler): """ - A handler to hold a conversation with a user by managing four collections of other handlers. + A handler to hold a conversation with a single user by managing four collections of other + handlers. Note that neither posts in Telegram Channels, nor group interactions with multiple + users are managed by instances of this class. The first collection, a ``list`` named ``entry_points``, is used to initiate the conversation, for example with a ``CommandHandler`` or ``RegexHandler``. @@ -113,7 +115,8 @@ class ConversationHandler(Handler): def check_update(self, update): - if not isinstance(update, Update): + # Ignore messages in channels + if not isinstance(update, Update) or update.channel_post: return False chat, user = extract_chat_and_user(update)