Telegram Bot没有回复消息

时间:2017-03-16 08:26:13

标签: php telegram telegram-bot php-telegram-bot

我在Debian 8上使用ISP与ISP 5.我安装了lib:https://github.com/akalongman/php-telegram-bot。 Webhook已经设置但是bot没有响应消息和命令。服务器没有日志,我不知道问题是什么:(

我收到了来自ISP管理器中用于IP地址的加密的SSL。 enter image description here

这是我的set.php

<?php
// Load composer
require __DIR__ . '/vendor/autoload.php';

$API_KEY = 'key';
$BOT_NAME = 'evtepo_bot';
$hook_url = 'https://213./hook.php';
try {
    // Create Telegram API object
    $telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);

    // Set webhook
    $result = $telegram->setWebhook($hook_url);
    if ($result->isOk()) {
        echo $result->getDescription();
    }

} catch (Longman\TelegramBot\Exception\TelegramException $e) {
    echo $e;
}

和hook.php

<?php
// Load composer
require __DIR__ . '/vendor/autoload.php';

$API_KEY = 'key';
$BOT_NAME = 'evtepo_bot';
$commands_path = __DIR__ . '/Commands/';

try {
    // Create Telegram API object
    $telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);

    // Handle telegram webhook request
    $telegram->handle();
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
     echo $e;
     \Longman\TelegramBot\TelegramLog::initErrorLog(__DIR__ . '/' . $BOT_NAME . '_error.log');
     \Longman\TelegramBot\TelegramLog::initDebugLog(__DIR__ . '/' . $BOT_NAME . '_debug.log');
     \Longman\TelegramBot\TelegramLog::initUpdateLog(__DIR__ . '/' . $BOT_NAME . '_update.log');
}

$telegram->addCommandsPath($commands_path);

2 个答案:

答案 0 :(得分:0)

您应该使用getWebhookInfo方法检查更新是否已发送到挂钩以及是否有任何错误。

答案 1 :(得分:0)

问题在于我需要购买域名并从Lets'Encrypt获取SSL。

相关问题