Skip to content

Conversation Handler responds to messages from channels #560

@gregsonar

Description

@gregsonar

Probably this error was already reported, but I could not find the existing issue

Steps to reproduce

  1. Start a bot with ConversationHandler

  2. Add your bot to channel and grant admin access

  3. Wait for any post in this channel

Expected behaviour

The bot should not respond to messages in channel

Actual behaviour

Bot unsuccessfully tries to react and gives an error like this:

`2017-04-11 10:03:17,283 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/telegram/ext/dispatcher.py", line 269, in process_update
if handler.check_update(update):
File "/usr/local/lib/python3.5/dist-packages/telegram/ext/conversationhandler.py", line 121, in check_update
key = (chat.id, user.id) if chat else (None, user.id)
AttributeError: 'NoneType' object has no attribute 'id'

I guess this is because user.id is empty in messages from channels

Configuration

Operating System:
Ubuntu 16.04.2 LTS (Xenial)

Version of Python, python-telegram-bot & dependencies:

$ python -m telegram
python-telegram-bot 5.3.0
urllib3 1.20
certifi 2017.01.23
future 0.16.0
Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions