我在Debian8和ISP5上使用服务器。我已经安装了库: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);发布于 2017-03-21 15:42:55
问题是我需要购买一个域名,并从get‘’Encrypt获得一个SSL。
发布于 2017-03-17 01:19:37
您应该使用getWebhookInfo方法来检查更新是否已传递到钩子,以及是否存在任何错误。
https://stackoverflow.com/questions/42828745
复制相似问题