coollemon/elasticsearch

适用于Telegram机器人的Elasticsearch模块

2.0.0 2019-05-25 16:51 UTC

This package is not auto-updated.

Last update: 2024-09-23 16:36:55 UTC


README

安装

在项目根目录下执行以下命令

composer require "coollemon/elasticsearch"

或者在composer.json文件中添加依赖

{  ...
    "require": {
        "coollemon/elasticsearch": "^2.0.0"
    }, ...
}

然后更新您的composer

composer update

使用方法

在根目录下创建一个名为public的目录,并在其中创建一个名为bot.php的文件,内容如下

<?php

require '../vendor/autoload.php';

use App\Telegram\TelegramBot;

$updates = json_decode(file_get_contents('php://input'), true);

$bot = new TelegramBot($updates, $token);
$bot->update();

在根目录下创建一个名为config的目录,并在其中创建一个名为conf.php的文件,内容如下

<?php

return [
  'telegram_token' => '12345:your_token',
  'es_hosts' => [
    'localhost:9200',
    '127.0.0.1:9200'
  ]
];

然后设置bot.php上的webhook

https://api.telegram.org/bot12345:YourBotToken/setWebhook?url=https://your.host/public/bot.php

机器人命令

帮助

/help

搜索文本

search: new

添加文本

add: New text

删除文本

remove: textID