getMe() public method

Returns basic information about the bot in form of a User object.
public getMe ( ) : Array
return Array
コード例 #1
0
require '../src/Telegram.php';
///////////// CONFIG YOUR BOT'S TOKEN /////////
// Create telegram Bot token with @BotFather - https://github.com/mgp25/Telegram-Bot-API/wiki/Setup-Guide
$token = "";
// 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'