pylakey/aiotdlib

Help on how to send buttons

hwmbing11 opened this issue · 1 comments

I want my robot to send buttons, but I don't know how to do it right. I hope to get help

button = InlineKeyboardButton(text='test', type_=InlineKeyboardButtonTypeUrl(url='https://google.com'))
    rows = [[button, button]]
    reply = ReplyMarkupInlineKeyboard(rows=rows)
    options = MessageSendOptions.construct(
        disable_notification=False,
        from_background=False,
        protect_content=False,
        scheduling_state=MessageSchedulingStateSendWhenOnline()
    )
    input_message_content = InputMessageText.construct(
        text='text',
        disable_web_page_preview=False,
        clear_draft=False,
    )
    await client.api.send_message(chat_id=AdminUser.chat_id, message_thread_id=0,
                                  reply_to_message_id=0, options=options, reply_markup=reply,
                                  input_message_content=input_message_content)

But I always get JSON errors

[Error 400] Failed to parse JSON object as TDLib request: Expected Object, got String

How can I send the button correctly?

What type of button variable you pass here: rows = [[button, button]]?