1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Add github-telegram hook

This commit is contained in:
Steffo 2019-01-02 18:51:20 +01:00
parent 0a07740bca
commit 1fbdd979f8

View file

@ -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"<b>{commit['message']}</b> 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"