Answer the question
In order to leave comments, you need to log in
A good framework for developing a bot?
Greetings. I already have a working bot for VK in pure php, and now I want to rewrite it so that everything is "beautiful". Choosing a framework, I came across botman.io . What can you say about this framework, is it good and worth using? If there are better examples, I'd love to hear it.
Answer the question
In order to leave comments, you need to log in
botman is currently the "best" ( IMHO ), because there is not a very large selection. All in all, it's not bad (if) good to study the documentation . For example, I recently made a VK driver for it (I'll upload it to github soon). Problems only with Telegram - if you use a server from the Russian Federation, it will not work. And so, in general, very good. Better, I have not yet met
P.S. before him, I wrote three bots "by hand" (for VK, Facebook and Web). Work norms, but more like "crutches", and not very convenient. And in botman "Hello world" in 39 lines of code, it looks like this for me:
<?php
require_once 'vendor/autoload.php';
use BotMan\BotMan\BotMan;
use BotMan\BotMan\BotManFactory;
use BotMan\BotMan\Drivers\DriverManager;
use BotMan\BotMan\Cache\CodeIgniterCache;
$config = [
'facebook' => [
'token' => 'EAAZAT6dcgYDQBAC6x7X******85SLSPF0BRCVeRPPgutgtfvZCkZC9lxnP5pYcRXtF0m7sOAliTEztGPR45cOxx3rZAMZBc9Mb9UhB62gBSG2kXTo7ldyk2fTquadMJQVY8nqKxiOakLXLUZBCSavncCljoe5IAZDZD',
'app_secret' => 'b52517e****71b6afa76dca657',
'verification'=>'my_example_veryfy_token',
],
"vkontakte" => [
"token" => "9af81c610faf0ea319*****d17b0b2b53b164ff3b18cc1b9d4e422fd15db046594139078"
],
'telegram' => [
'token' => '60176***:****fVCz43IblR72siiyfbebv7wgqCn8tc'
]
];
DriverManager::loadDriver(\BotMan\Drivers\Vkontakte\VkontakteDriver::class);
DriverManager::loadDriver(\BotMan\Drivers\Facebook\FacebookDriver::class);
DriverManager::loadDriver(\BotMan\Drivers\Telegram\TelegramDriver::class);
$this->load->driver('cache');
$botman = BotManFactory::create($config, new CodeIgniterCache($this->cache->file));
$botman->hears('привет', function (BotMan $bot) {
$bot->reply('Хай.');
});
$botman->fallback(function($bot) {
$bot->reply('Чё ??? ...');
});
$botman->listen();
iconv('utf-8', 'windows-1251', тут_ваш_ответ_сервера);
I used vibe.d for telegram bots. I can’t say if he is the best or not, he suited me.
Unfortunately, for all the time that we have to write bots for various messengers, we have not been able to find a universal solution for everything that could cover all our desires. Almost every messenger has its own features because of which it is loved, if you do not use them, then most likely no one will use your bot either. Regarding the choice of language, we settled on node.js in this regard for such real-time, it is good. Most messengers support communication via web sockets, which has a good effect on speed, responses and performance, and ready-made packages are available for all messengers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question