sendPoll中的'option'数组的电报bot php问题

时间:2019-07-04 15:33:19

标签: php bots telegram

我不知道如何使用代码,可能我在写“选项”数组时遇到了错误。附带代码。我对"sendMessage"使用了相同的elseif,效果很好。谢谢!

https://core.telegram.org/bots/api#sendpoll

'options' => array('A','B','C'),

这也不起作用

'options' => [ "A", "B", "C" ]

elseif(strpos($ text,“ / poll”)=== 0){

    $parameters2 = array(
        'chat_id' => $chatId,
        'options' => array('A','B','C'),
        'question' => "Select correct one",

    );

    sendButton('sendPoll', $parameters);

}

1 个答案:

答案 0 :(得分:0)

您可以在下面的代码中尝试使用

'options' => json_encode(array('A','B','C')),

代替

 'options' => array('A','B','C'),