|
@@ -22,17 +22,18 @@ def live_now(): # Check if the stream is live
|
|
|
|
|
|
def send_msg(msg):
|
|
def send_msg(msg):
|
|
if live_now() is True:
|
|
if live_now() is True:
|
|
|
|
+ logging.info(f'{get_now()} - Sending \"{nag}\"...')
|
|
new_status = {'body': msg}
|
|
new_status = {'body': msg}
|
|
headers = {'Authorization': f'Bearer {config.auth_bearer}'}
|
|
headers = {'Authorization': f'Bearer {config.auth_bearer}'}
|
|
response = requests.post(f'{config.owncast_url}/api/integrations/chat/send', data=json.dumps(new_status), headers=headers)
|
|
response = requests.post(f'{config.owncast_url}/api/integrations/chat/send', data=json.dumps(new_status), headers=headers)
|
|
return response.json()
|
|
return response.json()
|
|
else:
|
|
else:
|
|
- logging.info(f'{get_now()} - Owncast stream is not live, so not sending.')
|
|
|
|
|
|
+ logging.info(f'{get_now()} - Owncast stream is not live, so not sending messages.')
|
|
|
|
|
|
|
|
|
|
def main():
|
|
def main():
|
|
|
|
+ logging.info(f'{get_now()} - Starting nagbot...')
|
|
for nag in config.nags:
|
|
for nag in config.nags:
|
|
- logging.info(f'{get_now()} - Sending \"{nag}\"...')
|
|
|
|
send_msg(nag)
|
|
send_msg(nag)
|
|
time.sleep(config.interval) # Wait between messages
|
|
time.sleep(config.interval) # Wait between messages
|
|
|
|
|