Der-Henning / tgtg

Scanner for Too Good To Go Notifications
https://github.com/Der-Henning/tgtg/wiki
GNU General Public License v3.0
357 stars 59 forks source link

Error "'NoneType' object has no attribute 'chat'" when attempting to reserve bag through telegram bot #481

Open lucastwg opened 3 months ago

lucastwg commented 3 months ago

When attempting to reserve a bag through the /reserve command, the locations present as normal but the bot times out when selecting a location, checking bot shows [error "'NoneType' object has no attribute 'chat'"], the string is much longer and mentions callback_query=CallbackQuery but it contains a lot of personal information so I cannot share the whole string.

edides commented 3 months ago

faced the same issue, anyone has a solution?

floriegl commented 1 month ago

Yes, it got broken in https://github.com/Der-Henning/tgtg/commit/d04f8c9114a0473be71ddecb818e6a129c73edc4 . Checking out v1.20.3 should fix that. _is_my_chat function only checks chat.id but the fallback does not have a chat attribute, but only a user attribute which has the same id (don't know how it works for group chats tho.

@Der-Henning please don't create a release of the current master with this bug.

floriegl commented 1 month ago

Also this is the full message: Update "Update(callback_query=CallbackQuery(chat_instance='<chat_instance_id>', data=<tgtg_scanner.models.item.Item object at 0xXXXXXXXXXXXX>, from_user=User(first_name='<user_first_name>', id=<IMPORTANT_CHAT_ID>, is_bot=False, language_code='de', username='<user_username>'), id='<callback_query_id>', message=Message(channel_chat_created=False, chat=Chat(first_name='<user_first_name>', id=<IMPORTANT_CHAT_ID>, type=<ChatType.PRIVATE>, username='<user_username>'), date=datetime.datetime(<year>, <month>, <day>, <hour>, <minutes>, <seconds>, tzinfo=datetime.timezone.utc), delete_chat_photo=False, from_user=User(first_name='<bot_first_name>', id=<bot_id>, is_bot=True, username='<bot_username>'), group_chat_created=False, message_id=<short_message_id>, reply_markup=InlineKeyboardMarkup(inline_keyboard=<just_all_the_buttons_of_the_previous_message>), supergroup_chat_created=False, text='Select a Bag to reserve')), update_id=<update_id>)" caused error "'NoneType' object has no attribute 'chat'"