✨ Add better ytdl
This commit is contained in:
@@ -12,7 +12,7 @@ ini_set('log_errors', 1);
|
||||
|
||||
$config = include 'config.php';
|
||||
|
||||
$bot = new \Shikiryu\Bot\Bot($config);
|
||||
$bot = new Bot($config);
|
||||
|
||||
$signature = $_SERVER['HTTP_X_NEXTCLOUD_TALK_SIGNATURE'] ?? '';
|
||||
$random = $_SERVER['HTTP_X_NEXTCLOUD_TALK_RANDOM'] ?? '';
|
||||
@@ -27,18 +27,26 @@ $bot->hears('(convertis|télécharges?) (https?:\/\/[^\s]+) en (audio|video|vid
|
||||
|
||||
$bot->hears('lorem( ipsum)?', Lorem::class);
|
||||
|
||||
$bot->hears('(hello|hi|bonjour|salut)', function (\Shikiryu\Bot\Bot $bot) {
|
||||
$bot->hears('(hello|hi|bonjour|salut)', function (Bot $bot) {
|
||||
$bot->replyPolitely('Bonjour');
|
||||
});
|
||||
|
||||
$body = file_get_contents('php://input');
|
||||
$data = json_decode($body, true);
|
||||
try {
|
||||
$data = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
$data = [];
|
||||
}
|
||||
|
||||
// Only on message, not on event or whatever
|
||||
if ($data['type'] !== 'Create' || $data['object']['name'] !== 'message') {
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
$message = json_decode($data['object']['content'], true)['message'];
|
||||
try {
|
||||
$message = json_decode($data['object']['content'], true, 512, JSON_THROW_ON_ERROR)['message'];
|
||||
} catch (JsonException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$bot->listen($message);
|
||||
|
Reference in New Issue
Block a user