|
|
@@ -94,9 +94,11 @@ def chat_hook():
|
|
|
|
|
|
@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/newFollow triggered!\n_______________')
|
|
|
- followers.append(data)
|
|
|
+ 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
|
|
|
|
|
|
|
|
|
@@ -164,10 +166,14 @@ def kofi_hook():
|
|
|
|
|
|
@ocb.route('/checkFollows') # Polled by follower.html template to check for new followers
|
|
|
def check_follows():
|
|
|
- if followers:
|
|
|
- current_app.logger.debug(f'\n\n{format(followers[0])}\n\n')
|
|
|
- last_follower = followers.clear()
|
|
|
- return jsonify(last_follower)
|
|
|
+ alerts_dict = current_app.config['ALERTS']
|
|
|
+ follower = {'name': alerts_dict['follower'], 'reward': 'New Follow!'}
|
|
|
+ if follower['name']:
|
|
|
+ current_app.logger.info(f'New follower: \"{follower["name"]}\"')
|
|
|
+ alerts_dict['follower'] = ''
|
|
|
+ save_alerts(alerts_dict)
|
|
|
+
|
|
|
+ return jsonify(follower)
|
|
|
else:
|
|
|
current_app.logger.debug(f'No new followers')
|
|
|
return jsonify(None)
|
|
|
@@ -176,9 +182,9 @@ def check_follows():
|
|
|
@ocb.route('/checkGoals') # Polled by ocbalert.html template to check for new followers
|
|
|
def check_goals():
|
|
|
alerts_dict = current_app.config['ALERTS']
|
|
|
- rgoals = {'name': alerts_dict['g_name'], 'reward': alerts_dict['g_reward']}
|
|
|
+ rgoals = {'name': alerts_dict['g_name'], 'reward': 'GOAL!!'}
|
|
|
if rgoals['name']:
|
|
|
- current_app.logger.debug(f'\n\n{format(rgoals)}\n\n')
|
|
|
+ current_app.logger.debug(rgoals)
|
|
|
alerts_dict['g_name'] = ''
|
|
|
alerts_dict['g_reward'] = ''
|
|
|
save_alerts(alerts_dict)
|
|
|
@@ -191,9 +197,9 @@ def check_goals():
|
|
|
@ocb.route('/checkMilestones') # Polled by ocbalert.html template to check for new followers
|
|
|
def check_milestones():
|
|
|
alerts_dict = current_app.config['ALERTS']
|
|
|
- rmilestones = {'name': alerts_dict['m_name'], 'reward': alerts_dict['m_reward']}
|
|
|
+ rmilestones = {'name': alerts_dict['m_name'], 'reward': 'Milestone!'}
|
|
|
if rmilestones['name']:
|
|
|
- current_app.logger.info(f'\n\n{format(rmilestones)}\n\n')
|
|
|
+ current_app.logger.info(rmilestones)
|
|
|
alerts_dict['m_name'] = ''
|
|
|
alerts_dict['m_reward'] = ''
|
|
|
save_alerts(alerts_dict)
|