td icon indicating copy to clipboard operation
td copied to clipboard

Can't send more than 3 inline button rows in "replyMarkupInlineKeyboard" (Lua)

Open realsamanrad opened this issue 6 years ago • 1 comments

Hi. Could not send more than 3 inline button rows in "replyMarkupInlineKeyboard" type (at sendMessage method) ! This code works well:

assert(tdbot_function({
          ["@type"]="sendMessage",
          chat_id=msg.chat_id,
          reply_to_message_id=msg.id,
          disable_notification=false,
          from_background=true,
          reply_markup={
            ["@type"]="replyMarkupInlineKeyboard",
            rows={
				[0]={
					[0]={
						text="example",
						type={
						  ["@type"]="inlineKeyboardButtonTypeUrl",
						  url="https://example.com"
						}
					}
				},
				[1]={
					[0]={
						text="example",
						type={
						  ["@type"]="inlineKeyboardButtonTypeUrl",
						  url="https://example.com"
						}
					}
				},
				[2]={
					[0]={
						text="example",
						type={
						  ["@type"]="inlineKeyboardButtonTypeUrl",
						  url="https://example.com"
						}
					}
				}
            }
          },
          input_message_content={
            ["@type"]="inputMessageText",
            text={text="pong"},
            disable_web_page_preview=true,
            clear_draft=false,
            entities={},
            parse_mode=nil
          }
        },dl_cb, nil))

But this code below returns error that says:

[ 1][t 0][1533630509.544310093][clilua.cpp:148][!Td] FAILED TO PARSE LUA: [Error : 0 : Expected array, got JsonObject] [ 0][t 0][1533630509.544363022][clilua.cpp:186][!Td] lua: ./bot.lua:51: assertion failed!

assert(tdbot_function({
          ["@type"]="sendMessage",
          chat_id=msg.chat_id,
          reply_to_message_id=msg.id,
          disable_notification=false,
          from_background=true,
          reply_markup={
            ["@type"]="replyMarkupInlineKeyboard",
            rows={
				[0]={
					[0]={
						text="example",
						type={
						  ["@type"]="inlineKeyboardButtonTypeUrl",
						  url="https://example.com"
						}
					}
				},
				[1]={
					[0]={
						text="example",
						type={
						  ["@type"]="inlineKeyboardButtonTypeUrl",
						  url="https://example.com"
						}
					}
				},
				[2]={
					[0]={
						text="example",
						type={
						  ["@type"]="inlineKeyboardButtonTypeUrl",
						  url="https://example.com"
						}
					}
				},
				[3]={
					[0]={
						text="example",
						type={
						  ["@type"]="inlineKeyboardButtonTypeUrl",
						  url="https://example.com"
						}
					}
				}
            }
          },
          input_message_content={
            ["@type"]="inputMessageText",
            text={text="pong"},
            disable_web_page_preview=true,
            clear_draft=false,
            entities={},
            parse_mode=nil
          }
        },dl_cb, nil))

Is it a bug?!

realsamanrad avatar Aug 07 '18 08:08 realsamanrad

Possibly, it is a bug in tdbot conversion of lua objects to JSON arrays.

levlam avatar Aug 07 '18 09:08 levlam