Un bot sur le chat Synology
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1005 B

<?php
use Shikiryu\Bot\Bot;
use Shikiryu\Bot\Commands\Lorem;
use Shikiryu\Bot\Commands\Tasks;
use Shikiryu\Bot\Commands\TasksList;
use Shikiryu\Bot\Commands\TasksProjects;
use Shikiryu\Bot\Commands\Youtubedl;
use Shikiryu\Bot\Request;
require 'vendor/autoload.php';
error_reporting(E_ALL);
ini_set('log_errors', 1);
$config = include 'config.php';
$bot = new Bot($config);
$request = new Request($_POST);
if (!$bot->isValid($request)) {
exit(1);
}
// Give the bot something to listen for.
$bot->hears('(convertis|télécharges?) (https?:\/\/[^\s]+) en (audio|video|vidéo)', Youtubedl::class);
$bot->hears('lorem( ipsum)?', Lorem::class);
$bot->hears('liste.*projets?', TasksProjects::class);
$bot->hears('ajoute.*t(a|â)che (.*) dans "(.*)"', Tasks::class);
$bot->hears('(?:donne|liste).*t(?:a|â)ches? de "(.*)"', TasksList::class);
$bot->hears('(hello|hi|bonjour|salut)', function (Bot $bot) {
$bot->replyPolitely('Bonjour');
});
// Start listening
$bot->listen($_POST['text']);