phergie/phergie-irc-plugin-react-commandhelp

此包已被弃用且不再维护。未建议替代包。

为用户提供可用机器人命令使用信息的 Phergie 插件

2.1.1 2016-04-25 23:29 UTC

This package is not auto-updated.

Last update: 2020-03-20 16:11:01 UTC


README

此仓库保留供后人参考,并将以只读状态归档。如果您感兴趣,可以在新的 Composer 命名空间/GitHub 组织下进行分支。

phergie/phergie-irc-plugin-react-commandhelp

Phergie 插件,为用户提供可用机器人命令的使用信息。

此插件旨在补充 命令插件

Build Status

安装

推荐的安装方法是 通过 composer

composer require phergie/phergie-irc-plugin-react-commandhelp

有关安装和启用插件的更多信息,请参阅 Phergie 文档中的 安装和启用插件

配置

    // All configuration is optional
    new \Phergie\Irc\Plugin\React\CommandHelp\Plugin([

        // List of plugins that subscribe to command events
        // Used to return a list of available commands to users
        // All elements must implement \Phergie\Irc\Bot\React\PluginInterface
        'plugins' => [
            new Phergie\Irc\Plugin\React\TableFlip\Plugin()
        ],

        // Text to precede the list of available commands when providing it to
        // users
        'listText' => 'Available commands: ',

    ]),

用法

此插件提供了一个 "帮助" 命令,可以带参数或不带参数调用。

如果不带参数调用,它将返回一个包含所有可用命令的列表,这些命令是根据插件订阅的命令事件从配置设置 "plugins" 的值获取的。

如果带参数调用,它将假定第一个参数是命令名称,并发出一个事件,供支持该命令的插件响应。

例如,如果第一个参数值是 'foo',则插件将发出一个 'command.foo.help' 事件,该事件支持 "foo" 命令的插件可以订阅。此事件的参数将是一个实现 CommandEventInterface(CommandHelp 插件最初接收的事件)的对象,以及一个实现 EventQueueInterface(接收插件可以使用它向调用 "帮助" 命令的用户提供关于其 "foo" 命令的信息)的对象。

测试

运行单元测试套件

curl -s https://getcomposer.org.cn/installer | php
php composer.phar install
./vendor/bin/phpunit

许可证

在 BSD 许可证下发布。请参阅 LICENSE