Telegram Bot 不使用 Webhook,程序是 运行 但没有得到任何响应
Telegram Bot not working with Webhook, programme is running but not getting any response
我已经在 python 中创建了一个电报机器人,但我无法设置 webhook。经过一些研究,我设置了 webhook,但它不起作用。该代码正在使用 start_polling() 方法,但一段时间后停止在 heroku 服务器中工作,所以我想 运行 使用 webhook 的代码。
代码 运行ning 正确,但没有从电报中得到任何响应
PORT = int(os.environ.get('PORT', '5000'))
updater.start_webhook(listen="0.0.0.0", port=PORT, url_path=token,
webhook_url='https://git.heroku.com/pytelestock.git' + token)
当 运行 时 api 出现此错误。
{"ok":true,"result":{"url":"https://git.heroku.com/pytelestock.git1851418449:token","has_custom_certificate":false,"pending_update_count":2,"last_error_date":1622897956,"last_error_message":"Wrong response from the webhook: 404 Not Found","max_connections":40,"ip_address":"xx.xxx.xxx.xxx"}}
因为我是这个领域的新手,所以我不知道为什么会出现错误以及如何解决这个问题。
webhook_url 应该是 'pytelestock.herouk.com/' + token
。
我已经在 python 中创建了一个电报机器人,但我无法设置 webhook。经过一些研究,我设置了 webhook,但它不起作用。该代码正在使用 start_polling() 方法,但一段时间后停止在 heroku 服务器中工作,所以我想 运行 使用 webhook 的代码。 代码 运行ning 正确,但没有从电报中得到任何响应
PORT = int(os.environ.get('PORT', '5000'))
updater.start_webhook(listen="0.0.0.0", port=PORT, url_path=token,
webhook_url='https://git.heroku.com/pytelestock.git' + token)
当 运行 时 api 出现此错误。
{"ok":true,"result":{"url":"https://git.heroku.com/pytelestock.git1851418449:token","has_custom_certificate":false,"pending_update_count":2,"last_error_date":1622897956,"last_error_message":"Wrong response from the webhook: 404 Not Found","max_connections":40,"ip_address":"xx.xxx.xxx.xxx"}}
因为我是这个领域的新手,所以我不知道为什么会出现错误以及如何解决这个问题。
webhook_url 应该是 'pytelestock.herouk.com/' + token
。