completed bot logic

This commit is contained in:
2022-05-08 00:19:14 +03:00
parent 01f503bbe3
commit b3dec8fbf4
5 changed files with 430 additions and 0 deletions
View File
+24
View File
@@ -0,0 +1,24 @@
import flask
import telebot
from bot import bot
app = flask.Flask(__name__)
WEBHOOK_URL_PATH = "/{}".format(bot.token)
@app.route(WEBHOOK_URL_PATH, methods=["POST"])
def webhook():
if flask.request.headers.get("content-type") == "application/json":
json_string = flask.request.get_data().decode("utf-8")
update = telebot.types.Update.de_json(json_string)
bot.process_new_updates([update])
return ""
else:
flask.abort(403)
if __name__ == "__main__":
app.run()