Explorar o código

Add additional logging

deadtom hai 4 días
pai
achega
cd7b759e44
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      nagbot.py

+ 3 - 2
nagbot.py

@@ -22,17 +22,18 @@ def live_now():  # Check if the stream is live
 
 def send_msg(msg):
     if live_now() is True:
+        logging.info(f'{get_now()} - Sending \"{nag}\"...')
         new_status = {'body': msg}
         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)
         return response.json()
     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():
+    logging.info(f'{get_now()} - Starting nagbot...')
     for nag in config.nags:
-        logging.info(f'{get_now()} - Sending \"{nag}\"...')
         send_msg(nag)
         time.sleep(config.interval)  # Wait between messages