jungle-bay/telegram-bot-shell

此包已被废弃,不再维护。没有推荐替代包。

这是处理机器人命令的机制

此包尚未发布版本,且信息有限。


README

Travis CI Scrutinizer CI Codecov SensioLabsInsight

这是一个基于纯Telegram Bot API的Telegram机器人平台。
为什么是Shell,我被*nix操作系统中使用的Shell(命令解释器)所启发。

安装

推荐的安装方法是使用Composer

composer require jungle-bay/telegram-bot-shell

使用示例

<?php

require_once(__DIR__ . '/vendor/autoload.php');

$request = file_get_contents('php://input');                    // Request body. (JSON-serialized Update object)

$tba = new \TelegramBotShell\TelegramBotShell(array(
    'token'    => '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11',  // Your token bot.
    'adapter'  => $adapter,                                     // This adapter for Scrapbook library. See the complete: https://github.com/matthiasmullie/scrapbook#adapters
    'payload'  => $db,                                          // This payload will be passed to command the third parameter. (optional)
    'commands' => array(
        'default'  => \Acme\MyBot\Commands\DefaultCmd::class,   // This command will work by default if no command is found. (optional)
        'mappings' => array(                                    // This is the list of registered commands for the bot. (optional)
            'help' => \Acme\MyBot\Commands\HelpCmd::class,
            'user' => \Acme\MyBot\Commands\UserCmd::class
        )
    )
), $request);

$tba->run();

文档

完整的文档请见此处

为了方便开发,您可以使用Telegram Bot CLI

许可证

此软件包受MIT许可证的约束。完整的许可证请见文件:此处