那么如何让我的电报机器人 24/7 在线?

问题描述 投票:0回答:0
  1. 到目前为止,这是我的代码
  2. --

  3. `导入openai
  4. 来自 aiogram import Bot,类型
  5. 来自 aiogram.dispatcher 导入 Dispatcher
  6. 从 aiogram.utils 导入执行器
  7. 从 keep_alive 导入 keep_alive
  8. 令牌 = '令牌'
  9. openai.api_key = 'TOKEN_OPENAI'
  10. bot = 机器人(代币)
  11. dp = 调度员(机器人)
  12. @dp.message_handler()
  13. async def 发送(消息:types.Message):
  14. response = openai.Completion.create(
  15. model="text-davinci-003",
  16. prompt=message.text,
  17. 温度=0.9,
  18. max_tokens=1000,
  19. top_p=1,
  20. frequency_penalty=0.0,
  21. presence_penalty=0.6,
  22. stop=[“你:”]
  23. )
  24. await message.answer(response['choices'][0]['text'])
  25. executor.start_polling(dp, skip_updates=True)
  26. keep_alive()`
  27. 我已经尝试使用烧瓶,但仍然无法正常工作`
python-3.x python-telegram-bot
© www.soinside.com 2019 - 2024. All rights reserved.