|
|
@@ -70,16 +70,16 @@ def chat_hook():
|
|
|
send_private_chat(user_id, f'{display_name}, you have {porps(points)}.')
|
|
|
|
|
|
elif lowercase_msg.startswith(f'{prefix}reg_mail'): # Generate a code to verify users account for email registration
|
|
|
- if current_app.config['KOFI_SETTINGS']['integration']:
|
|
|
+ if current_app.config['KOFI_SETTINGS']['integration'] or current_app.config['GB_SETTINGS']['integration']:
|
|
|
mail_reg_code = get_email_code(db, user_id)
|
|
|
if mail_reg_code: # If the viewer already has a code waiting
|
|
|
- send_private_chat(user_id, f'{display_name}, your code is {mail_reg_code}. Enter it into the form on the Stream Rewards Info page, with your email address, to enable Kofi perks!')
|
|
|
+ send_private_chat(user_id, f'{display_name}, your code is {mail_reg_code}. Enter it into the form on the Stream Rewards Info page, with your email address, to enable donation perks!')
|
|
|
else: # if not
|
|
|
mail_reg_code = random.randint(100000, 999999)
|
|
|
if set_email_code(db, user_id, mail_reg_code):
|
|
|
- send_private_chat(user_id, f'{display_name}, your code is {mail_reg_code}. Enter it into the form on the Stream Rewards Info page, with your email address, to enable Kofi perks!')
|
|
|
+ send_private_chat(user_id, f'{display_name}, your code is {mail_reg_code}. Enter it into the form on the Stream Rewards Info page, with your email address, to enable donation perks!')
|
|
|
else:
|
|
|
- send_chat(f'{display_name}, Kofi integration is not enabled on this stream.')
|
|
|
+ send_chat(f'{display_name}, donation integration is not enabled on this stream.')
|
|
|
|
|
|
elif lowercase_msg.startswith(f'{prefix}rewards'): # Send rewards list
|
|
|
if current_app.config['REWARDS']:
|
|
|
@@ -163,7 +163,7 @@ def kofi_hook():
|
|
|
return jsonify({'status': 'Failed. No data'}), 400
|
|
|
return jsonify({'status': 'success'}), 200
|
|
|
else:
|
|
|
- current_app.logger.error(f'Kofi donation recieved, but Kofi integration is turned off. Rejected.')
|
|
|
+ current_app.logger.error(f'Kofi donation recieved, but Kofi integration is turned off. Doing nothing.')
|
|
|
return jsonify({'status': 'Failed. Not currently accepting Kofi donations.'}), 400
|
|
|
else:
|
|
|
return jsonify({'status': 'Failed. Invalid content type'}), 400
|
|
|
@@ -199,7 +199,7 @@ def gb_hook():
|
|
|
|
|
|
raw_data = request.get_data(as_text=True)
|
|
|
|
|
|
- signature = sign_payload(raw_data, gb_secret) # For TESTING purposes
|
|
|
+ # signature = sign_payload(raw_data, gb_secret) # For TESTING purposes
|
|
|
|
|
|
event = request.json
|
|
|
transaction = event['data'] # TESTING
|
|
|
@@ -208,7 +208,7 @@ def gb_hook():
|
|
|
amount = transaction['amount'] # TESTING
|
|
|
current_app.logger.info(f'\n\n{raw_data}\n\nSignature: {signature}\nFrom: {from_name}\nEmail: {email}\nAmount: {amount}\n\n') # TESTING
|
|
|
|
|
|
- if not verify_gbhook_signature(raw_data, signature, gb_secret): # TESTING
|
|
|
+ if not verify_gbhook_signature(raw_data, signature, gb_secret):
|
|
|
return jsonify({'error': 'Invalid signature'}), 401
|
|
|
if current_app.config['GB_SETTINGS']['integration']:
|
|
|
try:
|
|
|
@@ -228,7 +228,7 @@ def gb_hook():
|
|
|
except Exception as pgberror:
|
|
|
current_app.logger.error(f'General exception processing gbhook: {pgberror}')
|
|
|
else:
|
|
|
- current_app.logger.error(f'GiveButter donation recieved, but GiveButter integration is turned off. Rejected.')
|
|
|
+ current_app.logger.error(f'GiveButter donation recieved, but GiveButter integration is turned off. Doing nothing.')
|
|
|
return jsonify({'status': 'Failed. Not currently accepting GiveButter donations.'}), 400
|
|
|
|
|
|
return jsonify({'received': True}), 200
|