mirror of
https://github.com/andwati/unsplash-bot.git
synced 2026-10-18 02:32:54 +00:00
modified webhook
This commit is contained in:
+4
-1
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user