Skip to content

Commit 6a01164

Browse files
JosXatsnoam
authored andcommitted
ConversationHandler breaks when bot is also used in Channels (python-telegram-bot#487)
* ConversationHandler now ignores channel posts
1 parent 7f6b017 commit 6a01164

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The following wonderful people contributed directly or indirectly to this projec
3232
- `overquota <https://github.com/overquota>`_
3333
- `Patrick Hofmann <https://github.com/PH89>`_
3434
- `Rahiel Kasim <https://github.com/rahiel>`_
35+
- `Joscha Götzer <https://github.com/Rostgnom>`_
3536
- `Shelomentsev D <https://github.com/shelomentsevd>`_
3637
- `sooyhwang <https://github.com/sooyhwang>`_
3738
- `Valentijn <https://github.com/Faalentijn>`_

telegram/ext/conversationhandler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
class ConversationHandler(Handler):
3030
"""
31-
A handler to hold a conversation with a user by managing four collections of other handlers.
31+
A handler to hold a conversation with a single user by managing four collections of other
32+
handlers. Note that neither posts in Telegram Channels, nor group interactions with multiple
33+
users are managed by instances of this class.
3234
3335
The first collection, a ``list`` named ``entry_points``, is used to initiate the conversation,
3436
for example with a ``CommandHandler`` or ``RegexHandler``.
@@ -113,7 +115,8 @@ def __init__(self,
113115

114116
def check_update(self, update):
115117

116-
if not isinstance(update, Update):
118+
# Ignore messages in channels
119+
if not isinstance(update, Update) or update.channel_post:
117120
return False
118121

119122
chat, user = extract_chat_and_user(update)

0 commit comments

Comments
 (0)