heroku - Python-Telegram 机器人在本地运行,但不在 Heroku 上
问题描述
我希望在 Heroku 上部署我的 python-telegram 机器人,但该机器人似乎没有响应。.py 在本地工作得很好,但是当我部署它时,应用程序可以完美地构建并打开,但在提示时不会在电报上产生任何响应。代码非常基本,但我想我可能缺少 webhook 的一些东西?我是网络新手,因为我的背景更多是数据科学。下面是我的代码和procfile。
"""import telegram
from telegram.ext import Updater
from telegram.ext import CommandHandler
import ftx
client = ftx.FtxClient()
telegram_bot_token = "token"
updater = Updater(token=telegram_bot_token, use_context=True)
dispatcher = updater.dispatcher
def start(update, context):
chat_id = update.effective_chat.id
context.bot.send_message(chat_id=chat_id, text= "1 ***=" + "$" + str(client.get_market('***/USD')['last']) + "\n" + "24 Change =" + str(round(client.get_market('***/USD')['change24h'],2)*100) + "%" + "\n" + "24 Hour Volume =" + str(client.get_market('***/USD')['volumeUsd24h']) + "USD"
+ "\n"*2 + "The information presented by the price tracker is not meant to be taken as financial advice.")
#I think over here I need something else
dispatcher.add_handler(CommandHandler("***", start))
updater.start_polling()"""
#Proc
"""worker: python bot.py"""
我很高兴写一个 if dunder main,但我仍然不确定我是否需要一个 webhook。谢谢!
解决方案
推荐阅读
- r - 在 r 中绘制数据集
- angular - mat-slide-toggle [checked] 属性似乎不起作用
- android - 在 Internet 开启时在消息传递中遇到问题
- azure-devops - 如何使用 powershell 脚本在 Azure DevOps Pipeline 中安装 Taurus 和 Jmeter?
- javascript - 有没有办法为 react-dropzone (useDropzone) 添加默认值?
- ansible - 通过使用 Asnible 在一行中列出它们来替换一系列数字
- php - 亚马逊产品广告 API 不返回评分和评论
- dataframe - 如何在 Julia 数据框中转换纪元/unix 时间?
- python - 是否可以通过将鼠标移到标签上来选择/取消选择 QChecBox?
- algorithm - 我们应该对 LSD(最低有效位)基数排序中最右边的列进行排序吗?