|
|
@@ -17,7 +17,7 @@ def format(rawjson): # Make data legible
|
|
|
return formatted_data
|
|
|
|
|
|
|
|
|
-@ocb.route('/chatHook', methods=['POST'])
|
|
|
+@ocb.route('/ocbHook', methods=['POST'])
|
|
|
def chat_hook():
|
|
|
prefix = current_app.config['PREFIX']
|
|
|
data = request.json
|
|
|
@@ -34,6 +34,13 @@ def chat_hook():
|
|
|
if data['type'] == 'USER_JOINED': # Do username house cleaning when a viewer joins
|
|
|
if data['eventData']['user']['authenticated']:
|
|
|
remove_duplicates(db, user_id, display_name)
|
|
|
+ elif data['type'] == 'FEDIVERSE_ENGAGEMENT_FOLLOW':
|
|
|
+ alerts_dict = current_app.config['ALERTS']
|
|
|
+ data = request.json
|
|
|
+ current_app.logger.debug(f'\n\n_______________\n/followHook triggered!\n_______________')
|
|
|
+ alerts_dict['follower'] = data['eventData']['name']
|
|
|
+ save_alerts(alerts_dict)
|
|
|
+ return jsonify({'status': 'success'}), 200
|
|
|
elif data['type'] == 'NAME_CHANGE':
|
|
|
user_id = data['eventData']['user']['id']
|
|
|
new_name = data['eventData']['newName']
|
|
|
@@ -92,16 +99,6 @@ def chat_hook():
|
|
|
return data
|
|
|
|
|
|
|
|
|
-@ocb.route('/followHook', methods=['POST']) # Called by Owncast when someone follows
|
|
|
-def follow_hook():
|
|
|
- alerts_dict = current_app.config['ALERTS']
|
|
|
- data = request.json
|
|
|
- current_app.logger.debug(f'\n\n_______________\n/followHook triggered!\n_______________')
|
|
|
- alerts_dict['follower'] = data['eventData']['name']
|
|
|
- save_alerts(alerts_dict)
|
|
|
- return jsonify({'status': 'success'}), 200
|
|
|
-
|
|
|
-
|
|
|
@ocb.route('/kofiHook', methods=["POST"])
|
|
|
def kofi_hook():
|
|
|
current_app.logger.info(f'----------------------------------------------------------------------------')
|