zeroone2numeral2 / sticker-thief

Telegram bot to build custom sticker packs
https://t.me/stickersthiefbot
MIT License
68 stars 42 forks source link

/add: user_data is empty when the user selects a pack with duplicate titles in the database #12

Closed zeroone2numeral2 closed 4 years ago

zeroone2numeral2 commented 4 years ago

Steps to reproduce:

  1. /add
  2. select a pack with duplicate titles in the db
  3. select the name

Result: context.user_data is empty so we cannot get the name key in the following handler

Logs

[2019-10-17 21:43:57,658][bot.handlers.stickers.add][add:on_pack_name:99][INFO] >>> user selected the pack name from the keyboard
[2019-10-17 21:43:57,659][bot.handlers.stickers.add][add:on_pack_name:100][DEBUG] >>> user_data: {}
[2019-10-17 21:43:57,666][bot.utils.helpers.decorators][decorators:wrapped:35][ERROR] >>> error while running handler callback: 'NoneType' object has no attribute 'name'
Traceback (most recent call last):
  File "/root/sticker-thief/bot/utils/helpers/decorators.py", line 33, in wrapped
    return func(update, context, *args, **kwargs)
  File "/root/sticker-thief/bot/handlers/stickers/add.py", line 115, in on_pack_name
    pack_name = session.query(Pack).filter_by(title=selected_name).first().name
AttributeError: 'NoneType' object has no attribute 'name'
zeroone2numeral2 commented 4 years ago

Wrong bug lol