Skip to content
PHP Telegram bot Framework
Branch: master
Clone or download
Bogdan Kolesnev
Bogdan Kolesnev Eventer bug fixes
Latest commit 445921e May 4, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Eventer bug fixes May 4, 2019
.gitattributes Initial commit Dec 24, 2018
.gitignore add vendor folder Jan 13, 2019
CHANGELOG.md fix date Jan 13, 2019
README.md change readme Dec 25, 2018
composer.json Update version Jan 31, 2019
index.php change readme Dec 25, 2018

README.md

Telebot

Examples

$settings = [
        'api_token'  => '',
        'base_url'   => 'https://api.telegram.org/',
        'username'   => '',
        'use_proxy'  => false,
        'run_type'   => 0, // 0 - Polling, 1 - Webhook
        'hook_reply' => true,
        'debug_mode' => false,
        'timing'     => false,
        'log_mode'   => false,
        'log_path'   => __DIR__ . DIRECTORY_SEPARATOR . 'tb_log',
        'proxy'      => [
            'authorization' => '',
            'server'        => '',
            'proxy_type'    => '',
        ]
];

use Telebot\Core\Bot,
    Telebot\Core\Context;
    
$bot = new Bot($settings);
$bot->cmd('start', function(Context $ctx){
    $ctx->reply('Hi! Send me a sticker');
});

$bot->onMessage('sticker', function (Context $ctx){
    $ctx->reply('Nice:)');
});

$bot->hears('bye', function (Context $ctx){
    $ctx->reply('bye bye...');
});

$bot->txt('say {text:str}', function (Context $ctx){
    $ctx->reply($ctx->params['text']);
});

$bot->run();
You can’t perform that action at this time.