jabirchall / botman-driver-discord
botman的discord驱动程序
1.2.0
2021-04-22 21:00 UTC
Requires
- php: >=7.1
- botman/botman: ^2.5
- illuminate/support: ^6.0
- sylae/yasmin: ^v0.6
README
入门
将驱动程序添加到您的botman项目中 composer require jabirchall/botman-driver-discord
示例
$config = [ 'discord' =>[ 'token' => "your token", 'options' => [ 'disableClones' => true, 'disableEveryone' => true, 'fetchAllMembers' => false, 'messageCache' => true, 'messageCacheLifetime' => 600, 'messageSweepInterval' => 600, 'presenceCache' => false, 'userSweepInterval' => 600, 'ws.disabledEvents' => [], ], ], ]; // 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文件以了解详细信息