Skip to content

Bot tries to assign user id to anonymous channel post #695

@pingiun

Description

@pingiun

Steps to reproduce

  1. Add a bot to a channel that doesn't have post signing.
  2. Post something to that channel.
  3. Bot tries to assign a user id to the update, bot gets an AttributeError because there is no user.

Expected behaviour

The bot checks if the user is in the update before trying to get the id.

Actual behaviour

An AttributeError is thrown and the bot fails to process the update.

Configuration

Operating System:
macOS Sierra

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

python-telegram-bot 6.1.0
urllib3 1.20
certifi 2017.04.17
future 0.16.0
Python 3.6.0 (default, Dec 24 2016, 08:01:42)  [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

Logs

Traceback (most recent call last):
  File "/Users/jelle/.venv/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 264, in process_update
    if handler.check_update(update):
  File "/Users/jelle/.venv/lib/python3.6/site-packages/telegram/ext/conversationhandler.py", line 181, in check_update
    key = self._get_key(update)
  File "/Users/jelle/.venv/lib/python3.6/site-packages/telegram/ext/conversationhandler.py", line 164, in _get_key
    key.append(user.id)
AttributeError: 'NoneType' object has no attribute 'id'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions