Skip to content

Instantly share code, notes, and snippets.

@63phc
Created October 20, 2016 03:43
Show Gist options
  • Save 63phc/b48ee976ecc9be1b95e805b061660be6 to your computer and use it in GitHub Desktop.
Save 63phc/b48ee976ecc9be1b95e805b061660be6 to your computer and use it in GitHub Desktop.
'bot' => [
'class' => 'SonkoDmitry\Yii\TelegramBot\Component',
'apiToken' => '***',
],
потом в composer.json:
"autoload" : {
"files": ["autoload_libs/bot.php"],
"psr-4": { "yii\\composer\\": "" }
},
require_once "../../vendor/autoload.php";
try {
$bot = new \TelegramBot\Api\Client('***');
$bot->command('ping', function($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(), 'pong!');
});
$bot->run();
} catch (\TelegramBot\Api\Exception $e) {
exit($e->getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment