我有基于 Python 的电报机器人代码,我想将其部署在 azure 中。
from pyrogram import Client, filters
app = Client("abc_bot", api_id=api_id, api_hash=api_hash, bot_token=bot_token)
# Define a function to handle the /start command
@app.on_message(filters.command("start"))
def start_command(client, message):
# Send "Hello" as a response to the /start command
message.reply_text("Hello!")
# Run the bot
app.run()
我已经尝试了多种方法,但无法部署它,请引导我找到正确的方向,以便我可以在 azure 中部署 Python telegram bot 代码。我已经使用热解图库来构建我的机器人。
我使用你的 python 代码创建了一个简单的 Telegram 聊天机器人。
set BOT_TOKEN= <bot_token>
import os
from pyrogram import Client, filters
BOT_TOKEN = os.getenv('BOT_TOKEN')
app = Client("kpvrhello_bot", api_id=277XXXX18, api_hash="2d85ec95c014fXXXXXXe6269d", bot_token=BOT_TOKEN)
@app.on_message(filters.command("start"))
def start_command(client, message):
message.reply_text("Hello Pravallika, Welcome!!!")
app.run()
BOT_TOKEN
: