PHP code example of maalls / botman-bundle
1. Go to this page and download the library: Download maalls/botman-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maalls / botman-bundle example snippets
// in src/Service/MyService.php
function __construct(\Maalls\BotManBundle\Service\Factory $factory) {
// Create BotMan with BotFramework Driver.
$bot = $factory->createBotFramework(); // \BotMan\BotMan\BotMan
// Config can be added or overwritten
$bot = $factory->createBotFramework(["botman" => ["conversation_cache_time" => 5]]);
// OR with a specific driver
$bot = $factory->create(\BotMan\Drivers\Telegram\TelegramDriver::class, ["telegram" => ["token" => "xxxx"]]);
$bot->hears("(.*)", function($bot, $message) {
$bot->reply("Anyway, hello.");
});
}