douhaoqiao9304 2018-09-24 19:30
浏览 138

内联键盘Telegram bot [PHP]

I want that my bot when I write /orario he answer me with a inline keyboard.

So.. I created an array for my keyboard in this way:

$tastierino_giorno = '[{"text":"Testo","callback_data":"StampaMessaggio"}]';

and in another function I write this:

function tastieraInline($chatid, $tastierino)
{
    global $token;
    $messaggio = "Scegli per che giorno inviare il messaggio:";
    $tastiera = '&reply_markup={"inline_keyboard": 
  ['.urlencode($tastierino).'],"resize_keyboard":true}';
    $url = "https://api.telegram.org/$token/sendMessage?chat_id=$chatId&parse_mode=HTML&text=".urlencode($messaggio).$tastiera;

    file_get_contents($url);

}

After this, with an if, I check if the users has write "/orario".

} elseif($message == "/orario"){
        tastieraInline($chatid, $tastierino_giorno); 
}

Now the problem is that it doesn't works... what's the problem?

  • 写回答

0条回答 默认 最新

    报告相同问题?