Skip to content
This repository has been archived by the owner on Dec 6, 2018. It is now read-only.

不知道为什么跑不起来 #4

Closed
LetMeDecay opened this issue Aug 14, 2018 · 4 comments
Closed

不知道为什么跑不起来 #4

LetMeDecay opened this issue Aug 14, 2018 · 4 comments

Comments

@LetMeDecay
Copy link
Contributor

config如下

// config.js

https = {}
bot = {}
ui = {}

https.domain = 'tgbot.xxx.xx' // 域名
https.privateKey = '/usr/local/nginx/conf/ssl/xxx.key' // Key文件
https.certificate = '/usr/local/nginx/conf/ssl/xxx.cer' // CSR文件

bot.token = 'https://api.telegram.org/bot1234567:AAEAHwS-abcdefghihjlAM/' // BotFather返回的Token,以/结尾

ui.startHint = 'your link %s' // 用户发送/start时返回的内容,%s表示用户唯一URL
ui.userNotExistHint = 'none' // 用户不存在时的返回内容
ui.httpsTestHint = 'hello from nodejs with https'
ui.errorHint = 'error' // 错误提示

module.exports = {
    https: https,
    bot: bot,
    ui: ui
}

修改server.js的监听端口为8443
用nginx反向代理本地的8443端口,访问域名能看到
hello from nodejs with https
客户端输入任何命令都没反应

@Fndroid
Copy link
Owner

Fndroid commented Aug 14, 2018

bot注册了么?错误信息是什么

@LetMeDecay
Copy link
Contributor Author

LetMeDecay commented Aug 14, 2018

注册过了,域名也添加了
error日志出现过地址不对,被占用的情况,不过都解决了
现在就是只有out有日志

listening on port 433
/
listening on port 433
listening on port 433
listening on port 433
listening on port 433
listening on port 433

另外使用nginx反代是可以看到提示的,而直接访问 域名:8443 就没法看到提示

node先用的是官方的8.x版本,现在更新到10.x了

@LetMeDecay
Copy link
Contributor Author

curl结果这样的

curl -X GET https://tgbot.xxx.xx/sendMessage

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /sendMessage</pre>
</body>
</html>

curl -X GET https://tgbot.xxx.xx/sendMessage/:123

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>

@LetMeDecay
Copy link
Contributor Author

原来是要把webhook打开,并指向/inlineQuery

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants