itsimiro/microsoft-teams-botman-driver

Microsoft Teams Botman 驱动程序

dev-main 2021-12-23 20:50 UTC

This package is not auto-updated.

Last update: 2024-09-28 08:04:39 UTC


README

Botman 的基本指南。

文档

变更

现在,交互式答案总是以数组的形式返回。

/** @var array $value */
$value = $answer->getValue();

添加了对事件的支持。

  1. 会话更新
  2. 安装更新
  3. 消息反应
$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');

Office365 连接器卡片

$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();