Skip to content

Abiron/TelegramLibrary

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-TelegramLibrary

PHP Library for the new Telegram Bot API

  • Event based programming for the new bot api
  • Closures
  • Composer Ready
  • Fully OOP
  • All Methods and Types available
  • Documented

####Usage##### Initiate the TelegramBotApi object with your token. Register the wanted hook within the event handler Use the central "pushUpdate" Method to start the Handling

####Example####

use Tekook\TelegramLibrary;

$telegram = new TelegramLibrary\TelegramBotApi("<your token>");


$eventHandler = $telegram->getEventHandler();
$eventHandler->addHook(TelegramLibrary\Events::TEXT,
        function(\Tekook\TelegramLibrary\Types\Message $message) {
    if ($message->getText() == "A") {
        $message->reply("OK", ["reply_markup" => new TelegramLibrary\Markups\ReplyKeyboardHide()]);
    } else {
        $message->reply("Hello, " . $message->getFrom()->getFirstName() . " please answer A!",
                [
            "reply_markup" => new TelegramLibrary\Markups\ReplyKeyboardMarkup([
                ["A", "B"],
                ["C", "D"],
                ["E", "F"],
                    ])
        ]);
    }
});

$telegram->pushUpdate();

##Author## Julian Tekook

About

PHP Library for the new Telegram Bot API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%