我使用 WWW::Telegram::BotAPI(Telegram Bot API 的 Perl 实现)进行简单的机器人开发。
我需要创建一个自定义键盘(https://core.telegram.org/bots#keyboards)来回复(sendMessage 方法)。
用于键盘的电报 API https://core.telegram.org/bots/api/#replykeyboardmarkup用字符串数组的类型描述字段“键盘”。
例子:
my @buttons=(['one','two'],['three','four'],['five']);
但我做错了
print Dumper $api->SendMessage
({
chat_id => $from_id,
text => 'question text ?',
reply_to_message_id => $message_id,
reply_markup => {
keyboard => (['one','two'],['three','four'],['five']);
resize_keyboard => 1,
one_time_keyboard => 1
}
});
在输出转储中 - reply_markup 不存在。能做错什么?如何正确定义“键盘”字段?