Parcourir la source

Abandoned awarding points for following the stream.

deadtom il y a 2 semaines
Parent
commit
7652ce0b41

+ 0 - 1
ownchatbot/defaults/config.py

@@ -11,4 +11,3 @@ PREFIX = '!'  # Preceeds commands, so OwnchatBot knows what is a command
 GUNICORN = True    # Integrate OwnchatBot logging into Gunicorn
 KOFI_TOKEN = ''  # Needed to validate Ko-fi with OCB webhook. Get from Ko-fi Settings -> More -> API -> Webhooks -> Advanced - Verification Token.
 KOFI_INTEGRATION = False  # Integrate OwnchatBot with Ko-fi
-FOLLOW_POINTS = '50'  # How many points to award viewers for following

+ 1 - 2
ownchatbot/schema.sql

@@ -9,8 +9,7 @@ CREATE TABLE IF NOT EXISTS points (
   points INTEGER,  
   user_authed BOOLEAN NOT NULL,
   email TEXT,
-  code INTEGER,
-  followed TEXT
+  code INTEGER
 );
 
 CREATE TABLE goals (

+ 0 - 5
ownchatbot/templates/mgmt.html

@@ -258,11 +258,6 @@
                         <td> <input type="number" name="points_award" value="{{ settings_info[2] }}" size="5"  required> points</td>
                         <td>How many points do you want to award them?</td>
                     </tr>
-                    <tr>
-                        <td> <label for="follow_points">Follow Points:</label> </td>
-                        <td> <input type="number" name="follow_points" value="{{ settings_info[11] }}" size="5"  required> points</td>
-                        <td>How many points do you want to award viewers for following your stream?</td>
-                    </tr>
                     <tr>
                         <td> <label for="gunicorn_logging">Gunicorn Logging:</label> </td>
                         {% if settings_info[3] %}

+ 10 - 10
ownchatbot/templates/userpanel.html

@@ -105,17 +105,17 @@
                 {% set minutes_label = 'minute' if points_interval == 1 else 'minutes' %}
 
                 &nbsp;&nbsp;{{ user[1] }}, you currently have {{ user[2] }} {{ points_label }}.<br>
-                &nbsp;&nbsp;You are accruing {{ points_award }} {{ points_label }} every {{ points_interval }} {{ minutes_label }}.<br>
-                {% set points_label = 'point' if follow_points == 1 else 'points' %}
-                &nbsp;&nbsp;You can get {{ follow_points }} {{ points_label }} for following my stream.
-                {% if kofi_integration %}
-                    {% if kofi_settings['donations'] %}
-                        {% set d_points_label = 'point' if donation_points == 1 else 'points' %}
-                        {% set s_points_label = 'point' if sub_points == 1 else 'points' %}
-                        <br>&nbsp;&nbsp;You can also get {{ kofi_settings['donation_points'] }} {{ d_points_label }} for every dollar you donate on Kofi{% if kofi_settings['subs'] %}, and {{ kofi_settings['sub_points'] }} {{ s_points_label }} every month for subscribing to my Kofi page{% endif %}.
-                    {% endif %}
-                {% endif %}
             {% endfor %}
+            {% set points_label = 'point' if points_award == 1 else 'points' %}
+            {% set minutes_label = 'minute' if points_interval == 1 else 'minutes' %}
+            &nbsp;&nbsp;You earn {{ points_award }} {{ points_label }} every {{ points_interval }} {{ minutes_label }}.<br>
+            {% if kofi_integration %}
+                {% if kofi_settings['donations'] %}
+                    {% set d_points_label = 'point' if donation_points == 1 else 'points' %}
+                    {% set s_points_label = 'point' if sub_points == 1 else 'points' %}
+                    <br>&nbsp;&nbsp;You can also get {{ kofi_settings['donation_points'] }} {{ d_points_label }} for every dollar you donate on Kofi{% if kofi_settings['subs'] %}, and {{ kofi_settings['sub_points'] }} {{ s_points_label }} every month for subscribing to my Kofi page{% endif %}.
+                {% endif %}
+            {% endif %}
             <h3>Active Votes</h3>
             {% if votes %}
                 <table>

+ 1 - 1
ownchatbot/update_db.sql

@@ -1,2 +1,2 @@
-ALTER TABLE points ADD COLUMN followed TEXT;
+
 

+ 2 - 8
ownchatbot/web_panels.py

@@ -93,7 +93,6 @@ def mgmt():
     all_cats = current_app.config['ALL_CAT']
     points_interval = current_app.config['POINTS_INTERVAL']
     points_award = current_app.config['POINTS_AWARD']
-    follow_points = current_app.config['FOLLOW_POINTS']
     gunicorn_logging = current_app.config['GUNICORN']
     prefix = current_app.config['PREFIX']
     access_id = current_app.config['ACCESS_ID']
@@ -115,8 +114,7 @@ def mgmt():
         kofi_token,
         kofi_integration,
         announce_enable,
-        announce_interval,
-        follow_points
+        announce_interval
         ]
     
     return render_template('mgmt.html',
@@ -165,7 +163,6 @@ def user_panel():
     username = request.args.get('username')
     points_interval = current_app.config['POINTS_INTERVAL']
     points_award = current_app.config['POINTS_AWARD']
-    follow_points = current_app.config['FOLLOW_POINTS']
     if username is not None:
         users = get_all_users_by_name(db, username)
     else:
@@ -185,7 +182,6 @@ def user_panel():
                            username=username,
                            users=users,
                            instance=instance,
-                           follow_points=follow_points,
                            utc_timezone=utc_timezone)
 
 
@@ -325,7 +321,6 @@ def settings():
     owncast_url = request.form['owncast_url']
     kofi_integration = 'kofi_integration' in request.form
     kofi_token = request.form['kofi_token']
-    follow_points = request.form['follow_points']
     config_dict = {
         'POINTS_INTERVAL': points_interval,
         'POINTS_AWARD': points_award,
@@ -335,8 +330,7 @@ def settings():
         'ACCESS_TOKEN': access_token,
         'OWNCAST_URL': owncast_url,
         'KOFI_TOKEN': kofi_token,
-        'KOFI_INTEGRATION': kofi_integration,
-        'FOLLOW_POINTS': follow_points
+        'KOFI_INTEGRATION': kofi_integration
         }
     if save_config(config_dict):  # Save new config.py
         current_app.logger.info('Saved new config.')

+ 3 - 19
ownchatbot/webhooks.py

@@ -160,28 +160,12 @@ def votes():
                            votes=all_active_votes(db))
 
 
-@ocb.route('/newFollow', methods=['POST'])
+@ocb.route('/newFollow', methods=['POST'])  # Nothing implemented here, YET.
 def new_follow():
     data = request.json
     current_app.logger.info(f'\n\n{format(data)}\n\n')
     db = get_db()
     user_id = data['eventData']['id']
     display_name = data['eventData']['name']
-    follow_points = current_app.config['FOLLOW_POINTS']
-    if user_in_points(db, user_id):  # If the user is in the database
-        user_info = get_all_users_with_user_id(db, user_id)  # Get user info
-        followed_date = user_info['followed']
-        if followed_date:  # Check if the user has already followed
-            current_app.logger.info(f'{display_name}/{user_id} already followed on {followed_date}.\
-                                    Not awarding follow points.')  # Do not award points
-            return jsonify({'status': 'success'}), 200
-        else:
-            if mark_followed(db, user_id):  # Mark as followed in the points database
-                if award_chat_points(db, user_id, follow_points):  # Award points
-                    current_app.logger.info(f'Awarded {display_name}/{user_id} {follow_points} for following.')
-                return jsonify({'status': 'success'}), 200
-    else:  # If not, don't award points.
-        # Need to find out if Owncast creates a user in the database,
-        # and if the user id matches when the user joins chat.
-        current_app.logger.info(f'{display_name}/{user_id} not in database. Not awarding follow points.')
-        return jsonify({'status': 'success'}), 200
+
+    return jsonify({'status': 'success'}), 200

+ 0 - 2
update.sh

@@ -10,7 +10,6 @@ update_config() {
 
     NEW_VARIABLES="\
 ACCESS_ID = '$TOKEN_NAME'  # The name of your access token
-FOLLOW_POINTS = '50'  # How many points to award viewers for following
 "
 
     TEMP_FILE=$(mktemp)  # Create a temporary file
@@ -53,7 +52,6 @@ update_db() {  # Create the database. This also populates it with some goals and
 update_config
 activate_venv
 install_module
-update_db
 deactivate
 
 echo -e "***IMPORTANT***\n"