// HERE YOUR TOKEN
//////////////////////////////////////////////////
echo "####################################\n";
echo "# Telegram CLIENT #\n";
echo "####################################\n\n";
$tg = new telegramBot($token);
$chat_id = null;
$guessed = false;
$sendQuestion = false;
$offset = 0;
echo "Get Bot Information:\n";
$updates = $tg->getMe();
echo json_encode($updates) . "\n";
// Custom keyboard
$customKeyboard = [['7', '8', '9'], ['4', '5', '6'], ['1', '2', '3'], ['0']];
$reply_markup = $tg->replyKeyboardMarkup($customKeyboard, true, true);
do {
// Get updates the bot has received
// Offset to confirm previous updates
$updates = $tg->pollUpdates($offset);
if ($updates['ok'] && count($updates['result']) > 0) {
foreach ($updates['result'] as $data) {
if (is_null($chat_id)) {
$chat_id = $data['message']['chat']['id'];
}
if (!$sendQuestion) {
// sends an action 'typing'
$tg->sendChatAction($chat_id, 'typing');
// send message with a custom reply markup
$tg->sendMessage($chat_id, 'Guess the number', null, false, null, $reply_markup);
$sendQuestion = true;