* Add @cowmooobot to try it! * @author Gabriele Grillo <*****@*****.**> */ include "Telegram.php"; // Set the bot TOKEN $bot_id = "bot_token"; // Instances the class $telegram = new Telegram($bot_id); /* If you need to manually take some parameters * $result = $telegram->getData(); * $text = $result["message"] ["text"]; * $chat_id = $result["message"] ["chat"]["id"]; */ // Take text and chat_id from the message $text = $telegram->Text(); $chat_id = $telegram->ChatID(); if ($text == "/start") { $option = array(array("🐮"), array("Git", "Credit")); // Create a permanent custom keyboard $keyb = $telegram->buildKeyBoard($option, $onetime = false); $content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Welcome to CowBot 🐮 \nPlease type /cowsay or click the Cow button !"); $telegram->sendMessage($content); } if ($text == "/cowsay" || $text == "🐮") { $randstring = rand() . sha1(time()); $cowurl = "http://bangame.altervista.org/cowsay/fortune_image_w.php?preview=" . $randstring; $content = array('chat_id' => $chat_id, 'text' => $cowurl); $telegram->sendMessage($content); } if ($text == "/credit" || $text == "Credit") { $reply = "Eleirbag89 Telegram PHP API http://telegrambot.ienadeprex.com \nFrancesco Laurita (for the cowsay script) http://francesco-laurita.info/wordpress/fortune-cowsay-on-php-5";