alisoftware/phptgbot
Composer 安装命令:
composer require alisoftware/phptgbot
包简介
PHP Telegram Bot
关键字:
README 文档
README
PHP Telegram Bot
Installation
Using Composer
composer.json :
{
"require": {
"alisoftware/phptgbot": "*"
}
}
index.php:
<?php require __DIR__ .'/vendor/autoload.php' ; use \Alisoftware\Phptgbot as Bot; Bot::setToken(''); Bot::getMe();
Longpooling / Webhook
Example:
<?php require __DIR__ .'/vendor/autoload.php' ; use \Alisoftware\Phptgbot as Bot; Bot::setToken(''); // webhook // Bot::setToken('TOKEN',true); Bot::run(function($response){ if ($response['error'] == false) { $message = isset($response['message'])?$response['message']:false; $onChannel = isset($response['channel_post'])?$response['channel_post']:false; if ($message != false) onMessage($message); //if ($onChannel != false) onMessage($onChannel); } }); function onMessage($message){ print_r($message); if ($message['text'] == 'ping') { Bot::send('message','<b>PONG!</b>'); } }
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-12