itsimiro/ microsoft-teams-botman-driver
Microsoft Teams Botman 驱动程序
dev-main
2021-12-23 20:50 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- botman/driver-botframework: ^1.1
- illuminate/support: ^8.77
Requires (Dev)
- fakerphp/faker: ^1.9.1
- mockery/mockery: ^1.3.1
- phpunit/phpunit: ^9.3
- roave/security-advisories: dev-latest
This package is not auto-updated.
Last update: 2024-09-28 08:04:39 UTC
README
Botman 的基本指南。
变更
现在,交互式答案总是以数组的形式返回。
/** @var array $value */
$value = $answer->getValue();
添加了对事件的支持。
- 会话更新
- 安装更新
- 消息反应
$bot->on(MicrosoftTeamsDriver::INSTALLATION_UPDATE_EVENT, function ($payload, BotMan $bot) {
$bot->reply('Please type ```start``` to begin using the bot');
});
卡片
现在有新的电源系统可用,标准驱动程序不支持。
$message = (new HeroCardMessage())
->setTitle("Hi {$user->getFirstName()} I'm Bot")
->setText('Test text')
->addButton(TapAction::IM_BACK, 'Test', 'test');
$message = (new Office365ConnectorMessage())
->setTitle('Title')
->setSummary('Text')
->addSimpleSection('Section', 'Subtitle', 'Text');
您可以使用输入和按钮创建表单。
$message = (new FormMessageBuilder('Title'))
->addSeparateInput('first', 'first', 'first', 'second')
->addTextInput('email', 'Email', 'Enter your email')
->addSubmitButton('Submit')
->getMessage();
您可以通过创建新的构建器类来创建任何消息。
$tapAction = new TapAction(TapAction::IM_BACK, "test {$item->getId()}", $item->getTitle());
$message = (new ListMessageBuilder())
->setTitle('List of items')
->addItem($item->getTitle(), $item->getDescription(), $item->getImageUrl(), $tapAction)
->addPrevButton($item->getPrevPage())
->getMessage();