2017-03-16 101 views
1

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

我收到了SSL从咱们加密在ISP经理IP地址。 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); 

回答

0

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

+0

您是否使用Lets Encrypt cert安装了webhook?我试图从自签名证书切换到Lets Encrypt证书,但电报无法验证新证书。 – Poulad