mirror of
https://github.com/andwati/unsplash-bot.git
synced 2026-12-02 14:48:45 +00:00
change bot import in server.py Added index route
This commit is contained in:
@@ -14,8 +14,6 @@ bot.set_webhook(
|
|||||||
os.getenv("PROJECT_NAME"), os.getenv("TELEGRAM_TOKEN")
|
os.getenv("PROJECT_NAME"), os.getenv("TELEGRAM_TOKEN")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
print(os.getenv("PROJECT_NAME"))
|
|
||||||
print(os.getenv("TELEGRAM_TOKEN"))
|
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(commands=["start"])
|
@bot.message_handler(commands=["start"])
|
||||||
|
|||||||
+6
-1
@@ -1,13 +1,18 @@
|
|||||||
import flask
|
import flask
|
||||||
import telebot
|
import telebot
|
||||||
|
|
||||||
from .bot import bot
|
from bot import bot
|
||||||
|
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
|
|
||||||
WEBHOOK_URL_PATH = "/{}".format(bot.token)
|
WEBHOOK_URL_PATH = "/{}".format(bot.token)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
def index():
|
||||||
|
return "<h1>Index page</h1>"
|
||||||
|
|
||||||
|
|
||||||
@app.route(WEBHOOK_URL_PATH, methods=["POST"])
|
@app.route(WEBHOOK_URL_PATH, methods=["POST"])
|
||||||
def webhook():
|
def webhook():
|
||||||
if flask.request.headers.get("content-type") == "application/json":
|
if flask.request.headers.get("content-type") == "application/json":
|
||||||
|
|||||||
Reference in New Issue
Block a user