Relative Content

Tag Archive for javascriptpythontelegram-botpython-telegram-bot

NoneType’ object has no attribute ‘data’

I am creating a telegram bot for ordering food delivery in Python with AIogram 3 and WebApp functions. My catalog is made using HTML and JavaScript; from the window, data about the products selected by the user is transferred to the chat bot. Now I need to implement a full-fledged shopping cart that saves all selected products. However, there is a problem with this, in the script below I have a function ‘web_app’ that receives data from the catalog about the selected products and sends a message, I also made it so that it immediately adds these products to the cart. Then through ‘view_basket’ and ‘clear_basket’ the user can open the basket to view the contents and clear the basket respectively. However, when I try to open the recycle bin itself, I get an error: “in web_app
json_data = callback_query.web_app_data.data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘NoneType’ object has no attribute ‘data'”