marcusyan/botman-driver-discord

Botman 的 Discord 驱动器

1.0.2 2019-03-25 15:08 UTC

This package is auto-updated.

Last update: 2024-09-17 05:54:10 UTC


README

入门指南

将驱动器添加到您的 botman 项目中 composer require jabirchall/botman-driver-discord

示例

$config = [
    'discord' =>[
        'token' => "your token",

    ],
];

// Load the driver(s) you want to use
DriverManager::loadDriver(\JABirchall\BotMan\Drivers\Discord\DiscordDriver::class);
$loop = Factory::create();
$botman = BotManFactory::createForDiscord($config, $loop);

// Give the bot something to listen for.
$botman->hears('hello', function (BotMan $bot) {
    $bot->reply('Hello yourself.');
});

// start a convosation
$botman->hears('How are you', function (BotMan $bot) {
    $bot->ask("I'm a bot I have no feelings, How about you?", function (Answer $answer) use ($bot) {
        $bot->reply("Thats great, you said: ". $answer->getText());
    });
});

// Start listening
$botman->listen();
$loop->run();

先决条件

  • Botman 2.*
  • PHP 版本 7.1+
  • mbstring
  • Discord 机器人令牌

贡献

请阅读 CONTRIBUTING.md 了解我们的行为准则以及向我们提交拉取请求的流程。

作者

  • JABirchall - 维护者

还可以查看参与此项目的 贡献者列表

许可证

本项目采用 GNU AGPLv3 许可证 - 请参阅 LICENSE 文件以获取详细信息

致谢