簡體   English   中英

Telegram Bot 無法使用 Webhook,程序正在運行但沒有得到任何響應

[英]Telegram Bot not working with Webhook, programme is running but not getting any response

我在 python 中創建了一個電報機器人,但我無法設置 webhook。 經過一些研究,我設置了 webhook,但它不起作用。 該代碼正在使用 start_polling() 方法,但一段時間后停止在 heroku 服務器中工作,所以我想使用 webhook 運行代碼。 代碼運行正常,但沒有收到電報的任何響應

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM