mirror of
https://github.com/andwati/unsplash-bot.git
synced 2026-11-28 21:28:46 +00:00
modified webhook
This commit is contained in:
+4
-1
@@ -8,9 +8,12 @@ load_dotenv()
|
|||||||
|
|
||||||
bot = telebot.TeleBot(os.getenv("TELEGRAM_TOKEN"))
|
bot = telebot.TeleBot(os.getenv("TELEGRAM_TOKEN"))
|
||||||
|
|
||||||
|
# remove previous webhook
|
||||||
|
bot.remove_webhook()
|
||||||
|
|
||||||
# configure the webhook for the bot
|
# configure the webhook for the bot
|
||||||
bot.set_webhook(
|
bot.set_webhook(
|
||||||
"https://{}.herokuapp.com/{}".format(
|
"https://{}.herokuapp.com/{}/".format(
|
||||||
os.getenv("PROJECT_NAME"), os.getenv("TELEGRAM_TOKEN")
|
os.getenv("PROJECT_NAME"), os.getenv("TELEGRAM_TOKEN")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -10,12 +10,12 @@ app = flask.Flask(__name__)
|
|||||||
WEBHOOK_URL_PATH = "/{}".format(bot.token)
|
WEBHOOK_URL_PATH = "/{}".format(bot.token)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/", methods=["GET"])
|
||||||
def index():
|
def index():
|
||||||
return "<h1>Index page</h1>"
|
return "<h1>Index page</h1>"
|
||||||
|
|
||||||
|
|
||||||
@app.route(WEBHOOK_URL_PATH, methods=["GET"])
|
@app.route(WEBHOOK_URL_PATH, methods=["POST"])
|
||||||
def webhook():
|
def webhook():
|
||||||
"""
|
"""
|
||||||
sets the bot webhook
|
sets the bot webhook
|
||||||
|
|||||||
Reference in New Issue
Block a user