Remove last occurences of 'APP'

This commit is contained in:
Thomas Rubini 2023-02-16 08:28:58 +01:00
parent dbf4086e56
commit c50b73477c
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373
3 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,6 @@ from truthinquiry.ext import discord_bot
class TruthInquiryApp(flask.Flask):
"""
Main class of the app
A single instance 'APP' of this class will be created and shared across the files
The class itself is a child class of flask.Flask and has property representing other services
:attr SocketIO socketio_app: the SocketIO service

View File

@ -4,6 +4,7 @@ import asyncio
import discord
import truthinquiry.app as app
import truthinquiry.logic.game_logic
class DiscordBot:
@ -65,7 +66,7 @@ class DiscordBot:
"""
Update the bot's status using the app's current context
"""
games_n = len(app.APP.games_list)
games_n = len(app.game_logic.games_list)
activity_name = f"Handling {games_n} game{'' if games_n==1 else 's'} !"
activity = discord.Activity(name=activity_name, type=discord.ActivityType.watching)
await self.bot.change_presence(activity=activity)

View File

@ -102,7 +102,7 @@ def start_game():
return {"error": 1, "msg": "this game is already started"}
game.generate_data()
game.has_started = True
APP.socketio_app.emit("gamestart", {}, room="game."+game.game_id)
socket_io.emit("gamestart", {}, room="game."+game.game_id)
return {"error": 0}
@routes_api.route("/getGameData", methods=["GET", "POST"])
@ -168,7 +168,7 @@ def game_progress():
username = flask.session["username"]
game.get_member(username).progress += 1
APP.socketio_app.emit("gameprogress", [flask.session["username"]], room="game."+game.game_id)
socket_io.emit("gameprogress", [flask.session["username"]], room="game."+game.game_id)
return {"error": 0}
@ -200,7 +200,7 @@ def check_anwser():
member.results = results
if game.has_finished():
json_game_results = game.generate_game_results()
APP.socketio_app.emit("gamefinished", json_game_results, room="game."+game.game_id)
socket_io.emit("gamefinished", json_game_results, room="game."+game.game_id)
del game
response = {"error": 0}
return response