laravel版本:6.3.0
Botman版本:2.5
嘿
我想用我现有的laravel项目创建一个电报机器人。
这是我已完成的步骤:
1-安装botman:
composer require botman/botman
2-install驱动程序电报:
composer require botman/driver-telegram
3-为Botman创建名为BotmanController
的控制器
4-为botman路由:
Route::get('/botman' , 'BotmanController@index')->name('botman.index');
名为@rahyaab_bot
的5-make电报机器人和获取token
的
6-register webhook,漫游器网址为:https://demo98.ir/botman
:
7-并在BotManController中:
<?php
namespace App\Http\Controllers;
use BotMan\BotMan\BotMan;
use Illuminate\Http\Request;
use BotMan\BotMan\BotManFactory;
use BotMan\BotMan\Drivers\DriverManager;
use BotMan\Drivers\Telegram\TelegramDriver;
class BotmanController extends Controller
{
public function index()
{
$config = [
// Your driver-specific configuration
"telegram" => [
"token" => "THETOKEN"
]
];
DriverManager::loadDriver(TelegramDriver::class);
$botman = BotManFactory::create($config);
$botman->hears('Hi', function (BotMan $bot) {
$bot->reply('Hello yourself.');
});
$botman->listen();
}
}
我启动漫游器并说Hi
,但电报漫游器没有应答。
出了什么问题?
谢谢。