|
@@ -47,9 +47,14 @@ def create_app(test_config=None):
|
|
global current_index
|
|
global current_index
|
|
app.config.from_pyfile('announce.py', silent=True)
|
|
app.config.from_pyfile('announce.py', silent=True)
|
|
announcements = app.config['ANNOUNCEMENTS']
|
|
announcements = app.config['ANNOUNCEMENTS']
|
|
- message = announcements[current_index]
|
|
|
|
- send_system_chat(message)
|
|
|
|
- current_index = (current_index + 1) % len(announcements)
|
|
|
|
|
|
+ if current_index >= len(announcements): # If reached the last announement, reset index
|
|
|
|
+ current_index = 0
|
|
|
|
+ try:
|
|
|
|
+ message = announcements[current_index]
|
|
|
|
+ send_system_chat(message)
|
|
|
|
+ current_index = (current_index + 1) % len(announcements)
|
|
|
|
+ except Exception as a_error:
|
|
|
|
+ app.logger.error(f'Couldn\'t make announcement: {a_error.args[0]}')
|
|
|
|
|
|
def award_job():
|
|
def award_job():
|
|
with app.app_context():
|
|
with app.app_context():
|