定制 tigris/tigris 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tigris/tigris

Composer 安装命令:

composer require tigris/tigris

包简介

Tigris is a modern Telegram bot framework written in PHP

README 文档

README

Build Status Join the chat at https://gitter.im/tigris-php/tigris GitHub license

Tigris is a modern reactive event-driven Telegram bot framework written in PHP.

Usage

Without extending the Bot class

Create a bot instance

$bot = (new BotFactory())->create($apiToken);

Define your custom even handlers

$bot = (new BotFactory())->create($apiToken);
$bot->addListener(MessageEvent::EVENT_TEXT_MESSAGE_RECEIVED, function (MessageEvent $event) use ($bot) {
    // sending your first message
    $bot->getApi()->sendMessage([
        'chat_id' => $event->message->chat->id, 
        'text' => 'Hello World!',
    ]);
});

Run your bot

$bot->run();

Extending the Bot class

Extend the Tigris\Bot class to create your own bot implementation

class SampleBot extends \Tigris\Bot
{
    // bootstraping your bot
    public function bootstrap()
    {
        // registering event callback
        $this->addListener(MessageEvent::EVENT_TEXT_MESSAGE_RECEIVED, function (MessageEvent $event) {
            // sending your first message
            $this->getApi()->sendMessage([
                'chat_id' => $event->message->chat->id, 
                'text' => 'Hello World!',
            ]);
        });   
    }
}

Run the bot instance

$bot = (new BotFactory(SampleBot::class))->create($apiToken);
$bot->run();

License

MIT

统计信息

  • 总下载量: 87
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固