Search code examples
pythontelegramtelethon

Telegram telethon send query widget from another bot (Quizbot)


In telegram app, when I type @Quizbot quiz:ViioLbLq in message box, I get a widget above message box, and when I click on that widget, a message gets forwarded with a 'via Quizbot' text above. When I do the same in telethon,

client.send_message(someone, "@Quizbot quiz:ViioLbLq")

only the plain text is forwarded someone i.e. @Quizbot quiz:ViioLbLq .

I expect it to forward a full message with a 'via Quizbot' above. Why doesn't it work?


Solution

  • You need to use client.inline_query for this:

    results = await client.inline_query('Quizbot', 'quiz:ViioLbLq')
    # send the first result to some chat
    message = await results[0].click('some group username')