modified webhook

This commit is contained in:
2022-05-15 18:56:51 +03:00
parent 69a60eac19
commit 1579e558f2
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -8,9 +8,12 @@ load_dotenv()
bot = telebot.TeleBot(os.getenv("TELEGRAM_TOKEN"))
# remove previous webhook
bot.remove_webhook()
# configure the webhook for the bot
bot.set_webhook(
"https://{}.herokuapp.com/{}".format(
"https://{}.herokuapp.com/{}/".format(
os.getenv("PROJECT_NAME"), os.getenv("TELEGRAM_TOKEN")
)
)
+2 -2
View File
@@ -10,12 +10,12 @@ app = flask.Flask(__name__)
WEBHOOK_URL_PATH = "/{}".format(bot.token)
@app.route("/")
@app.route("/", methods=["GET"])
def index():
return "<h1>Index page</h1>"
@app.route(WEBHOOK_URL_PATH, methods=["GET"])
@app.route(WEBHOOK_URL_PATH, methods=["POST"])
def webhook():
"""
sets the bot webhook