ameliabot/bot.py

35 lines
834 B
Python
Raw Permalink Normal View History

2022-04-19 13:27:39 +03:00
#!/usr/bin/env python
# import argparse
from flask import Flask, Response, request
2023-10-24 11:12:29 +03:00
from core import config, owncast, __version__
from core.logger import logging
2022-04-19 13:27:39 +03:00
# args = parser.parse_args()
2022-05-03 21:37:31 +03:00
app = Flask(__name__)
logging.debug("Loaded %s, running ameliabot v%s" % (
config["DEFAULT"]["BotName"], __version__))
2022-04-19 13:27:39 +03:00
# the url of the Owncast API for bot posts
owncast_url = "{}/api/integrations/chat/send".format(
config["owncast"]["ServerURL"])
2022-04-19 13:27:39 +03:00
@app.route('/webhook/owncast', methods=['POST'])
def respond():
owncast.parse_webhook()
return Response(status=200)
@app.route('/webhook/fedi', methods=['POST'])
def fedipost():
args = request.args
repo = args.get("repo")
# Incredibly insecure lmao
if repo:
fedi.parse_webhook(args.get("repo"))
return Response(status=200)
return 400