S
S
szjyakgf2022-03-24 15:56:56
Python
szjyakgf, 2022-03-24 15:56:56

How to fix the error when working with inline mode?

Bot for telegram on aiogram. It is necessary that when the user enters the bot in inline mode, I should have the 'Text1' button. When it is pressed, a message is sent: 'Text3'
At the same time, no matter what was entered after the user, the button is always 1 and does not change. But even with such an easy task, I can not understand what I did wrong.

@dp.inline_handler(lambda query: types.InlineQuery)
async def inline_handler(query):
    test = types.InlineQueryResultArticle(
        id='1', title="Текст1",
        message_text="Текст2",
        input_message_content=types.InputTextMessageContent(
        message_text="Текст3"))

Mistake:
TypeError: __init__() got an unexpected keyword argument 'message_text'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2022-03-24
@szjyakgf

And what does the message_text of the InlineQueryResultArticle do? This is a parameter to the InputTextMessageContent constructor. It's no wonder it swears.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question