Remove last occurences of 'APP'
This commit is contained in:
parent
dbf4086e56
commit
c50b73477c
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user