【问题标题】:My application on the heroku server stops after running for 1 minute (PYTHON)我在 heroku 服务器上的应用程序在运行 1 分钟后停止(PYTHON)
【发布时间】:2021-06-13 15:21:26
【问题描述】:

我在 heroku 服务器上的应用程序在运行 1 分钟后停止。然后它运行并随时听到发送给它自己的命令。我想知道它是否可以从 30 分钟的限制开始,但它从来没有那么长时间。

from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import commands as c

TOKEN = "--------------"

def main():
    updater = Updater(TOKEN, use_context=True)
    dp = updater.dispatcher

    #my commands
    dp.add_handler(CommandHandler("start", c.start_command))


    #while I write unknown word that the bot doesnt know
    dp.add_handler(MessageHandler(Filters.text, c.wrong_command))

    updater.start_polling()
    updater.idle()


if __name__ == "__main__":
    main()

#commands.py

from telegram.ext import Updater


def start_command(update, context):
     message = "hi!"

     return update.message.reply_text(message)

def wrong_command(update, context):
     message = "/start only"

     return update.message.reply_text(message)

requirements.txt """

python-telegram-bot

过程文件

web: python main.py

【问题讨论】:

    标签: heroku bots


    【解决方案1】:

    """"标志"中的代码不多。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-25
      • 1970-01-01
      • 2013-06-23
      • 1970-01-01
      • 2017-08-15
      • 2020-02-19
      • 1970-01-01
      • 2011-12-20
      相关资源
      最近更新 更多