소스 검색

Fixed announcements not refreshing bug, and kofi message appearing with Kofi integration disabled

deadtom 2 주 전
부모
커밋
4d9d70ef01
4개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 1
      TODO.md
  2. 1 2
      ownchatbot/__init__.py
  3. 4 3
      ownchatbot/bot_messages.py
  4. 1 0
      ownchatbot/reward_handlers.py

+ 3 - 1
TODO.md

@@ -1 +1,3 @@
-
+* Get Kofi subscriptions and tiers sorted out.
+* Add acknowledgement to install script, that I am not responsible for any loss of viewers data, and the streamer is solely responsible for backing it up and maintaining it.
+* Add celebration emojis in messages for things like goals and milestones.

+ 1 - 2
ownchatbot/__init__.py

@@ -43,11 +43,10 @@ def create_app(test_config=None):
     from . import db  # Set up cli commands
     db.init_app(app)
 
-    announcements = app.config['ANNOUNCEMENTS']
-
     def announce():
         if app.config['ANNOUNCE_ENABLE']:  # If announcements are enabled
             global current_index
+            announcements = app.config['ANNOUNCEMENTS']
             message = announcements[current_index]
             send_system_chat(message)
             current_index = (current_index + 1) % len(announcements)

+ 4 - 3
ownchatbot/bot_messages.py

@@ -138,9 +138,9 @@ def help_message(user_id):
         message = f'{message}<br><br>\
             Kofi is enabled! <br>\
             Authenticate with Owncast, and enter your email address into the Stream Rewards Info page to get Kofi perks.'
-    if kofi_settings['tips']:
-        message = f'{message}<br>\
-        You\'ll recieve {kofi_settings["tip_points"]} points for every dollar you tip on Kofi.'
+        if kofi_settings['tips']:
+            message = f'{message}<br>\
+            You\'ll recieve {kofi_settings["tip_points"]} points for every dollar you tip on Kofi.'
     send_private_chat(user_id, message)
 
 
@@ -153,6 +153,7 @@ ANNOUNCE_INTERVAL = {announce_dict['ANNOUNCE_INTERVAL']}  # How long, in minutes
     try:
         with open(announce_file, 'w') as f:
             f.write(new_announce)
+            f.close()
     except Exception as saerror:
         current_app.logger.error(f'Couldn\'t save announce.py: {saerror.args[0]}')
         return False

+ 1 - 0
ownchatbot/reward_handlers.py

@@ -295,6 +295,7 @@ def save_rewards(reward_info):  # Write rewards to rewards.py
     try:
         with open(rewards_file, 'w') as f:
             f.write(f'REWARDS = {new_rewards}')
+            f.close()
     except Exception as srerror:
         current_app.logger.error(f'Couldn\'t save rewards.py: {srerror.args[0]}')
         return False