add owncast instance url to config

This commit is contained in:
Lili (Tlapka) 2022-08-22 16:58:10 +02:00
parent ef88403ca4
commit ad692e5938
2 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
SECRET_KEY='dev'
DATABASE='./instance/tlapbot.sqlite'
OWNCAST_ACCESS_TOKEN=''
OWNCAST_ACCESS_TOKEN=''
OWNCAST_INSTANCE_URL='http://localhost:8080'

View File

@ -36,7 +36,7 @@ def addUserToDatabase(user_id, db):
print("To user:", user_id)
def sendChat(message): # TODO: url to constant?
url = 'http://localhost:8080/api/integrations/chat/send'
url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/integrations/chat/send'
headers = {"Authorization": "Bearer " + current_app.config['OWNCAST_ACCESS_TOKEN']}
r = requests.post(url, headers=headers, json={"body": message})
return r.json()