我想将聊天机器人(BotMan 2.0 版)集成到现有的 OctoberCMS 项目中,这是我到目前为止所做的:
1-我使用以下命令将 BotMan 添加到项目中:
composer require botman/botman
2-我在与routes.php
文件相同的目录中创建了一个plugin.php
文件
<?php
use BotMan\BotMan\BotMan;
use BotMan\BotMan\BotManFactory;
use BotMan\BotMan\Drivers\DriverManager;
//Route::match(['get', 'post'], '/botman', 'BotManController@handle');
//Route::get('/botman/tinker', 'October\Demo\BotManController@tinker');
// Create an instance
$botman = BotManFactory::create($config);
// Give the bot something to listen for.
$botman->hears('hello', function (BotMan $bot) {
$bot->reply('Hello yourself.');
});
// Start listening
$botman->listen();
我的问题是:
1-我必须添加 BotManController.php 文件
2-我尝试将 BotManController.php 添加到与 routes.php 文件相同的目录中,但出现以下错误:
Class 'App\Http\Controllers\Controller' not found
(那是因为它是一个 OctoberCMS 项目而不是 Laravel 项目......我没有 App 目录)
任何人都可以为我提供一个解决方案或其他方式将 Botman 集成到 OctoberCMS 中!