From 1fbdd979f8a2a849f5e0bc34844fe53decd7c93c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 2 Jan 2019 18:51:20 +0100 Subject: [PATCH] Add github-telegram hook --- webserver.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/webserver.py b/webserver.py index 0ecc8409..4e7f3e9e 100644 --- a/webserver.py +++ b/webserver.py @@ -402,6 +402,20 @@ def ses_identify(): return response +@app.route("/hooks/github") +def hooks_github(): + try: + j = request.get_json() + except Exception: + abort(400) + return + message = f"🐙 {j['size']} aggiornamenti a Royalnet ricevuti:\n" + for commit in j.get("commits", []): + message += f"{commit['message']} di {commit['author']}\n" + telegram_bot.send_message(config["Telegram"]["main_group"], + parse_mode="HTML", disable_web_page_preview=True, disable_notification=True) + + @app.before_request def pre_request(): fl_g.css = "nryg.less"