【发布时间】:2021-02-26 19:27:40
【问题描述】:
这是我的 bot.py 脚本:
import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
# Define a few command handlers. These usually take the two arguments update and
# context. Error handlers also receive the raised TelegramError object in error.
def start(update, context):
update.message.reply_text("Start")
def main():
updater = Updater(TOKEN, use_context=True)
dp = updater.dispatcher
dp.add_handler(CommandHandler("start", start))
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
我可以通过python bot.py在本地运行它
但是,我不知道如何部署到 Django 生产服务器。
如何使它与view.py 一起工作?我必须为它创建一个视图吗?
有人可以帮忙吗?
【问题讨论】:
-
您找到解决方案了吗?
标签: python django telegram-bot python-telegram-bot