diff --git a/main_controller.py b/main_controller.py index 368b2b7..eb0b8af 100644 --- a/main_controller.py +++ b/main_controller.py @@ -118,7 +118,7 @@ def create_league(): ### SOCKETS -thread2 = threading.Thread(target=socketio.run,args=(app,"0.0.0.0", "80")) +thread2 = threading.Thread(target=socketio.run,args=(app,"127.0.0.1", "8080")) thread2.start() master_games_dic = {} #key timestamp : (game game, {} state) @@ -133,7 +133,10 @@ def update_loop(): global socket_thread while True: if socket_thread is not None: - socket_thread.join() + try: + socket_thread.join() + except: + pass game_states = [] game_ids = iter(master_games_dic.copy().keys()) for game_id in game_ids: diff --git a/the_prestige.py b/the_prestige.py index c931cab..e7a3dac 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -9,6 +9,7 @@ import weather data_dir = "data" config_filename = os.path.join(data_dir, "config.json") +app = main_controller.app class Command: def isauthorized(self, user): @@ -718,7 +719,7 @@ class DraftFlagsCommand(Command): async def execute(self, msg, command, flags): text = """Currently accepted flags: --draftsize or -d: Sets the size of each draft pool. ---minsize or -m: Sets the size at which the pool completely refreshes. +--refresh or -r: Sets the size at which the pool completely refreshes. --teamsize or -t: How big each team should be, including pitchers. --pitchercount or -p: How many pitchers each team should have. --wait or -w: Sets the timeout, in seconds, to wait for draftees to pick a player. @@ -792,9 +793,9 @@ class StartDraftCommand(Command): if mention in handle_token: handle = mention break - else: - await msg.channel.send(f"I don't recognize {handle_token}.") - return + else: + await msg.channel.send(f"I don't recognize {handle_token}.") + return team_name = content[i + 1].strip() if games.get_team(team_name): await msg.channel.send(f'Sorry {handle}, {team_name} already exists') @@ -1692,6 +1693,10 @@ active_standings = {} setupmessages = {} +thread1 = threading.Thread(target=main_controller.update_loop) +thread1.start() + + thread1 = threading.Thread(target=main_controller.update_loop) thread1.start() @@ -2795,4 +2800,4 @@ async def league_subscriber_update(league, start_channel, message): else: await channel.send(message) -client.run(config()["token"]) \ No newline at end of file +client.run(config()["token"])