async def on_ready(): config.init_config(bot) print("Logged in as") print(bot.user.name) print(bot.user.id) print("------") scheduling.init_scheduler() # Schedule tasks # Since on_ready may run multiple times due to reconnects, we need to make # sure we only schedule jobs once global scheduler_initialized if not scheduler_initialized: scheduler_initialized = True if len(config.squadservers) > 0: scheduling.interval_execute( update_squad_messages, [], interval_seconds=config.UPDATE_INTERVAL_SECONDS) await update_squad_messages() else: print( "No Squad servers configured. Skipping Squad status updating.") if len(config.postservers) > 0: scheduling.interval_execute( update_post_messages, [], interval_seconds=config.UPDATE_INTERVAL_SECONDS) await update_post_messages() else: print( "No Post Scriptum servers configured. Skipping Post Scriptum status updating." )
async def on_ready(): config.init_config(bot) print("Logged in as") print(bot.user.name) print(bot.user.id) print("------") scheduling.init_scheduler()
async def on_ready(): print('Logged in as') print(bot.user.name) print(bot.user.id) print('------') init_scheduler() await init() print('------')
return render_template('login.j2', error_message=error, show_menu=False, show_refresh=False) @app.route('/settings', methods=['GET', 'POST']) @app.route('/settings/<error>', methods=['GET', 'POST']) def settings(error=None): """Loads the settings page or saves settings..""" if request.method == 'POST': username = session['username'] current_password = request.form.get('current_password') new_password = request.form.get('new_password') confirm_password = request.form.get('confirm_password') try_result = auth.try_change_password(username, current_password, new_password, confirm_password) if try_result is not None: return render_template('settings.j2', error_message=try_result, show_menu=True, show_refresh=False) return redirect(url_for('home')) else: return render_template('settings.j2', error_message=error, show_menu=True, show_refresh=False) @app.route('/logout') def logout(): """Nullifies the session.""" session.pop('username', None) return redirect(url_for('home')) if __name__ == '__main__': scheduling.init_scheduler() auth.init_auth() init_visibility() app.secret_key = 'a3ddad8e-2288-414e-9d7d-c5dd9018fef0' app.run(debug=True, host='0.0.0.0', port=80, use_reloader=False)