mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-27 08:50:38 +01:00
ConvesationHandler - check if a user exist before using it (#699)
Fixes #695
This commit is contained in:
parent
08d298eb60
commit
8320227b2a
3 changed files with 8 additions and 1 deletions
|
@ -32,6 +32,7 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||||
- `Jacob Bom <https://github.com/bomjacob>`_
|
- `Jacob Bom <https://github.com/bomjacob>`_
|
||||||
- `JASON0916 <https://github.com/JASON0916>`_
|
- `JASON0916 <https://github.com/JASON0916>`_
|
||||||
- `jeffffc <https://github.com/jeffffc>`_
|
- `jeffffc <https://github.com/jeffffc>`_
|
||||||
|
- `Jelle Besseling <https://github.com/pingiun>`_
|
||||||
- `jh0ker <https://github.com/jh0ker>`_
|
- `jh0ker <https://github.com/jh0ker>`_
|
||||||
- `John Yong <https://github.com/whipermr5>`_
|
- `John Yong <https://github.com/whipermr5>`_
|
||||||
- `jossalgon <https://github.com/jossalgon>`_
|
- `jossalgon <https://github.com/jossalgon>`_
|
||||||
|
|
|
@ -160,7 +160,7 @@ class ConversationHandler(Handler):
|
||||||
if self.per_chat:
|
if self.per_chat:
|
||||||
key.append(chat.id)
|
key.append(chat.id)
|
||||||
|
|
||||||
if self.per_user:
|
if self.per_user and user is not None:
|
||||||
key.append(user.id)
|
key.append(user.id)
|
||||||
|
|
||||||
if self.per_message:
|
if self.per_message:
|
||||||
|
|
|
@ -330,6 +330,12 @@ class ConversationHandlerTest(BaseTest, unittest.TestCase):
|
||||||
update = Update(0, callback_query=cbq)
|
update = Update(0, callback_query=cbq)
|
||||||
handler.check_update(update)
|
handler.check_update(update)
|
||||||
|
|
||||||
|
def test_channelMessageWithoutChat(self):
|
||||||
|
handler = ConversationHandler(entry_points=[CommandHandler('start', self.start_end)], states={}, fallbacks=[])
|
||||||
|
message = Message(0, None, None, Chat(0, Chat.CHANNEL, "Misses Test"))
|
||||||
|
update = Update(0, message=message)
|
||||||
|
handler.check_update(update)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue