From 5e4c372d3803285a752ecc8930ef300fb6077c3b Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Tue, 19 Apr 2022 14:06:44 +0300 Subject: [PATCH] Okay *now* it posts to the proper url --- ameliabot/owncast.py | 5 ++++- ameliabot/quote.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ameliabot/owncast.py b/ameliabot/owncast.py index 4e3b3a4..033e185 100644 --- a/ameliabot/owncast.py +++ b/ameliabot/owncast.py @@ -40,6 +40,8 @@ headers = CaseInsensitiveDict() headers["Content-Type"] = "application/json" headers["Authorization"] = "Bearer {}".format(config["access_token"]) +post_url = "%s/api/integrations/chat/send" % config["owncast_server"] + def parse_webhook(): hook_type = request.json["type"] @@ -51,10 +53,11 @@ def parse_webhook(): if data: send_message(data) + def send_message(data): data = '{"body": "%s"}' % data resp = requests.post( - config["owncast_server"], + post_url, headers=headers, data=data.encode('utf-8')) diff --git a/ameliabot/quote.py b/ameliabot/quote.py index 763891c..2958ef4 100644 --- a/ameliabot/quote.py +++ b/ameliabot/quote.py @@ -13,7 +13,8 @@ except ModuleNotFoundError: class Quote: def __init__(self, database, user, password): - self.conn = psycopg2.connect(database=database, user=user, password=password) + self.conn = psycopg2.connect( + database=database, user=user, password=password) self.num_quotes = self._get_num_quotes() def insert(self, owner, submitter, text):