Botman 没有回复下面是我的代码
所有文件都是通过composer下载的
PHP 7.0
版 Codeigniter 3 版
控制器:-
require __DIR__ . '/vendor/autoload.php';
use BotMan\BotMan\BotMan;
use BotMan\BotMan\Drivers\DriverManager;
use BotMan\BotMan\BotManFactory;
use BotMan\BotMan\Cache\CodeIgniterCache;
defined('BASEPATH') OR exit('No direct script access allowed');
class Home extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('healthcare_model');
$config = [
'botman' => [
'conversation_cache_time' => 30
],
];
// Load the driver(s) you want to use
// Create an instance
$this->load->driver('cache');
$this->botman = BotManFactory::create($config, new CodeIgniterCache($this->cache->file));
}
public function chat() {
$this->load->view('home/chat', $data);
}
public function chat_reply() {
$this->botman->hears('hello', function($bot) {
$bot->reply('bye~');
});
// Listen
$this->botman->listen();
}
看法:
<!doctype html>
<html>
<head>
<title>BotMan Widget</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/assets/css/chat.min.css">
</head>
<body>
<script id="botmanWidget" src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/chat.js'></script>
</body>
<script>
var botmanWidget = {
frameEndpoint: '/home/chat',
chatServer: '/home/chat_reply'
};
</script>
<script src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js'></script>
我无法找到问题,因为它没有显示任何问题但没有回复。
请帮忙!!!提前致谢。