From 7f5df5b47b55ab17fd56f7026943f9cbec2af1fa Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sat, 26 Dec 2020 21:21:43 -0500 Subject: [PATCH 01/12] fixed the math for extra innings --- the_prestige.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index 64ec1b9..8fcc175 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -483,8 +483,8 @@ async def watch_game(channel, game): await asyncio.sleep(6) title_string = f"{newgame.teams['away'].name} at {newgame.teams['home'].name} ended after {newgame.inning} innings" - if newgame.inning > (newgame.max_innings - 1): #if extra innings - title_string += f" with {newgame.inning - (newgame.max_innings-1)} extra innings." + if (newgame.inning - 1) > newgame.max_innings: #if extra innings + title_string += f" with {newgame.inning - (newgame.max_innings+1)} extra innings." else: title_string += "." From 663fc6c3f60fd4b89536945481539f9111d0a35c Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sat, 26 Dec 2020 21:36:39 -0500 Subject: [PATCH 02/12] added countactivegames admin command --- the_prestige.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index 8fcc175..b9427aa 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -156,7 +156,7 @@ async def on_message(msg): return for game in gamesarray: - if game[0].name == msg.author.name: + if game.name == msg.author.name: await msg.channel.send("You've already got a game in progress! Wait a tick, boss.") return try: @@ -231,6 +231,9 @@ if you did it correctly, you'll get a team embed with a prompt to confirm. Hit t text = "Can't find that command, boss; try checking the list with `m;help`." await msg.channel.send(text) + elif command == "countactivegames" and msg.author.id in config()["owners"]: + await msg.channel.send(f"There's {len(gamesarray)} active games right now, boss.") + @@ -395,11 +398,7 @@ async def watch_game(channel, game): await asyncio.sleep(1) await embed.pin() await asyncio.sleep(1) - use_emoji_names = True - for game in gamesarray: - if game[1]: - use_emoji_names = False - gamesarray.append((newgame,use_emoji_names)) + gamesarray.append(newgame) pause = 0 top_of_inning = True victory_lap = False @@ -506,7 +505,7 @@ async def watch_game(channel, game): await embed.edit(content=None, embed=final_embed) await embed.unpin() - gamesarray.pop(gamesarray.index((newgame,use_emoji_names))) #cleanup is important! + gamesarray.pop(gamesarray.index(newgame)) #cleanup is important! newgame.add_stats() del newgame From e3690995446b5b0ecb14c28138cb6b275cf51a00 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sat, 26 Dec 2020 21:53:46 -0500 Subject: [PATCH 03/12] added team owner id to database --- database.py | 11 ++++++----- games.py | 4 ++-- the_prestige.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/database.py b/database.py index 1db05e7..2595158 100644 --- a/database.py +++ b/database.py @@ -62,7 +62,8 @@ def initialcheck(): counter integer PRIMARY KEY, name text NOT NULL, team_json_string text NOT NULL, - timestamp text NOT NULL + timestamp text NOT NULL, + owner_id integer ); """ if conn is not None: @@ -190,14 +191,14 @@ def get_user_player(user): conn.close() return player -def save_team(name, team_json_string): +def save_team(name, team_json_string, user_id): conn = create_connection() try: if conn is not None: c = conn.cursor() - store_string = """ INSERT INTO teams(name, team_json_string, timestamp) - VALUES (?,?, ?) """ - c.execute(store_string, (re.sub('[^A-Za-z0-9 ]+', '', name), team_json_string, datetime.datetime.now(datetime.timezone.utc))) #this regex removes all non-standard characters + store_string = """ INSERT INTO teams(name, team_json_string, timestamp, owner_id) + VALUES (?,?, ?, ?) """ + c.execute(store_string, (re.sub('[^A-Za-z0-9 ]+', '', name), team_json_string, datetime.datetime.now(datetime.timezone.utc), user_id)) #this regex removes all non-standard characters conn.commit() conn.close() return True diff --git a/games.py b/games.py index 8e85366..81ea9cb 100644 --- a/games.py +++ b/games.py @@ -479,11 +479,11 @@ def get_team(name): # except: #return None -def save_team(this_team): +def save_team(this_team, user_id): try: this_team.prepare_for_save() team_json_string = jsonpickle.encode(this_team, keys=True) - db.save_team(this_team.name, team_json_string) + db.save_team(this_team.name, team_json_string, user_id) return True except: return None diff --git a/the_prestige.py b/the_prestige.py index b9427aa..9f188d4 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -573,7 +573,7 @@ async def save_team_batch(message, command): react, user = await client.wait_for('reaction_add', timeout=20.0, check=react_check) if react.emoji == "👍": await message.channel.send("You got it, chief. Saving now.") - games.save_team(newteam) + games.save_team(newteam, message.author.id) await message.channel.send("Saved! Thank you for flying Air Matteo. We hope you had a pleasant data entry.") return elif react.emoji == "👎": From 43736e28f52cf5e7f5b16a79ffbab089cb363e5e Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sat, 26 Dec 2020 22:53:32 -0500 Subject: [PATCH 04/12] delete startgame message after game start --- the_prestige.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index 9f188d4..ad437e8 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -144,7 +144,9 @@ async def on_message(msg): if team1 is not None and team2 is not None: game = games.game(msg.author.name, team1, team2, length=innings) - game_task = asyncio.create_task(watch_game(msg.channel, game)) + channel = msg.channel + await msg.delete() + game_task = asyncio.create_task(watch_game(channel, game)) await game_task elif command.startswith("setupgame"): @@ -481,7 +483,7 @@ async def watch_game(channel, game): pause -= 1 await asyncio.sleep(6) - title_string = f"{newgame.teams['away'].name} at {newgame.teams['home'].name} ended after {newgame.inning} innings" + title_string = f"{newgame.teams['away'].name} at {newgame.teams['home'].name} ended after {newgame.inning-1} innings" if (newgame.inning - 1) > newgame.max_innings: #if extra innings title_string += f" with {newgame.inning - (newgame.max_innings+1)} extra innings." else: From bade9c4ede2521bfa8c1bc21c1d185b415acab2e Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Dec 2020 00:52:34 -0500 Subject: [PATCH 05/12] added a game queue for more than 45 consecutive games --- the_prestige.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index ad437e8..db16682 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -4,6 +4,7 @@ import onomancer as ono client = discord.Client() gamesarray = [] +gamesqueue = [] setupmessages = {} def config(): @@ -116,10 +117,8 @@ async def on_message(msg): elif command.startswith("startgame\n"): - if len(gamesarray) > 45: - await msg.channel.send("We're running 45 games and we doubt Discord will be happy with any more. These edit requests don't come cheap.") - return - elif config()["game_freeze"]: + + if config()["game_freeze"]: await msg.channel.send("Patch incoming. We're not allowing new games right now.") return @@ -145,7 +144,13 @@ async def on_message(msg): if team1 is not None and team2 is not None: game = games.game(msg.author.name, team1, team2, length=innings) channel = msg.channel + user_mention = msg.author.mention await msg.delete() + if len(gamesarray) >= 45: + await channel.send(f"We're running 45 games right now, and Discord probably isn't very pleased about it. You're at #{len(gamesqueue)+1} in the list.\nWe'll ping you when it's ready, chief.") + gamesqueue.append((channel, game, user_mention)) + return + game_task = asyncio.create_task(watch_game(channel, game)) await game_task @@ -510,6 +515,17 @@ async def watch_game(channel, game): gamesarray.pop(gamesarray.index(newgame)) #cleanup is important! newgame.add_stats() del newgame + if len(gamesqueue) > 0: + channel, game, user_mention = gamesqueue.pop(0) + queue_task = asyncio.create_task(play_from_queue(channel, game, user_mention)) + await queue_task + +async def play_from_queue(channel, game, user_mention): + await channel.send(f"{user_mention}, your game's ready.") + game_task = asyncio.create_task(watch_game(channel, game)) + await game_task + + def build_team_embed(team): embed = discord.Embed(color=discord.Color.purple(), title=team.name) From c91ab77b6f5763a1fc6f1cd3bf9781d4480b7723 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Dec 2020 02:06:43 -0500 Subject: [PATCH 06/12] sim overhaul: more baserunner motion, less double plays, better fielders' choice text --- games.py | 82 +++++++++++++++++++++++++++++++++++++------------ the_prestige.py | 8 +++-- 2 files changed, 69 insertions(+), 21 deletions(-) diff --git a/games.py b/games.py index 81ea9cb..32f2923 100644 --- a/games.py +++ b/games.py @@ -26,7 +26,7 @@ class appearance_outcomes(Enum): strikeoutswinging = "strikes out swinging." groundout = "grounds out to" flyout = "flies out to" - fielderschoice = "reaches on fielder's choice." + fielderschoice = "reaches on fielder's choice. {} is out at {} base." #requires .format(player, base_string) doubleplay = "grounds into a double play!" sacrifice = "hits a sacrifice fly towards" walk = "draws a walk." @@ -182,21 +182,29 @@ class game(object): else: outcome["text"] = appearance_outcomes.walk - if self.bases[1] is not None and hitnum < -1.3 and self.outs != 2: + if self.bases[1] is not None and hitnum < -2 and self.outs != 2: outcome["text"] = appearance_outcomes.doubleplay outcome["defender"] = "" - for base in self.bases.values(): - if base is not None: - fc_flag = True + #for base in self.bases.values(): + #if base is not None: + #fc_flag = True - if fc_flag and self.outs < 2: - if 0 <= hitnum and hitnum < 1.5: + runners = [(0,self.get_batter())] + for base in range(1,4): + if self.bases[base] == None: + break + runners.append((base, self.bases[base])) + outcome["runners"] = runners #list of consecutive baserunners: (base number, player object) + + if self.outs < 2 and len(runners) > 1: #fielder's choice replaces not great groundouts if any forceouts are present + if -1.5 <= hitnum and hitnum < 0.5: #poorly hit groundouts outcome["text"] = appearance_outcomes.fielderschoice outcome["defender"] = "" - elif 2.5 <= hitnum: - if self.bases[2] is not None or self.bases[3] is not None: - outcome["advance"] = True + + if 2.5 <= hitnum: #well hit flyouts can lead to sacrifice flies/advanced runners + if self.bases[2] is not None or self.bases[3] is not None: + outcome["advance"] = True else: outcome["ishit"] = True if hitnum < 1: @@ -237,15 +245,34 @@ class game(object): return runs elif outcome["text"] == appearance_outcomes.fielderschoice: - for base in range(3, 0, -1): - if self.bases[base] is not None: - self.fc_out = self.bases[base] - for movebase in range(base,1,-1): - self.bases[movebase] = self.bases[movebase-1] - break - self.bases[1] = self.get_batter() + furthest_base, runner = outcome["runners"].pop() #get furthest baserunner + self.bases[furthest_base] = None + outcome["fc_out"] = (runner.name, base_string(furthest_base+1)) #runner thrown out + for index in range(0,len(outcome["runners"])): + base, this_runner = outcome["runners"].pop() + self.bases[base+1] = this_runner #includes batter, at base 0 + if self.bases[3] is not None and furthest_base == 1: #fielders' choice with runners on the corners + self.bases[3] = None + return 1 return 0 + elif outcome["text"] == appearance_outcomes.groundout or outcome["text"] == appearance_outcomes.doubleplay: + runs = 0 + if self.bases[3] is not None: + runs += 1 + self.bases[3] = None + if self.bases[2] is not None: + run_roll = random.gauss(math.erf(random_star_gen("baserunning_stars", self.bases[2])-def_stat)-.5,1.5) + if run_roll > 0: + self.bases[3] = self.bases[2] + self.bases[2] = None + if self.bases[1] is not None: #double plays set this to None before this call + run_roll = random.gauss(math.erf(random_star_gen("baserunning_stars", self.bases[1])-def_stat)-.5,1.5) + if run_roll > 1: + self.bases[2] = self.bases[1] + self.bases[1] = None + return runs + elif outcome["ishit"]: runs = 0 if outcome["text"] == appearance_outcomes.single: @@ -353,7 +380,9 @@ class game(object): elif result["text"] == appearance_outcomes.doubleplay: self.get_pitcher().game_stats["outs_pitched"] += 2 self.outs += 2 - self.bases[1] = None + self.bases[1] = None + scores_to_add += self.baserunner_check(defender, result) + self.get_batter().game_stats["rbis"] -= scores_to_add #remove the fake rbi from the player in advance elif result["text"] == appearance_outcomes.fielderschoice: self.get_pitcher().game_stats["outs_pitched"] += 1 @@ -373,6 +402,11 @@ class game(object): self.get_batter().game_stats["strikeouts_taken"] += 1 self.get_pitcher().game_stats["strikeouts_given"] += 1 + elif result["text"] == appearance_outcomes.groundout: + self.get_pitcher().game_stats["outs_pitched"] += 1 + self.outs += 1 + scores_to_add += self.baserunner_check(defender, result) + else: self.get_pitcher().game_stats["outs_pitched"] += 1 self.outs += 1 @@ -500,4 +534,14 @@ def search_team(search_term): for team_pickle in db.search_teams(search_term): this_team = jsonpickle.decode(team_pickle[0], keys=True, classes=team) teams.append(this_team) - return teams \ No newline at end of file + return teams + +def base_string(base): + if base == 1: + return "first" + elif base == 2: + return "second" + elif base == 3: + return "third" + elif base == 4: + return "fourth" \ No newline at end of file diff --git a/the_prestige.py b/the_prestige.py index db16682..20cad60 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -453,7 +453,11 @@ async def watch_game(channel, game): if newgame.last_update[0]["defender"] != "": punc = ". " - updatestring = f"{newgame.last_update[0]['batter']} {newgame.last_update[0]['text'].value} {newgame.last_update[0]['defender']}{punc}" + if "fc_out" in newgame.last_update[0].keys(): + name, base_string = newgame.last_update[0]['fc_out'] + updatestring = f"{newgame.last_update[0]['batter']} {newgame.last_update[0]['text'].value.format(name, base_string)} {newgame.last_update[0]['defender']}{punc}" + else: + updatestring = f"{newgame.last_update[0]['batter']} {newgame.last_update[0]['text'].value} {newgame.last_update[0]['defender']}{punc}" if newgame.last_update[1] > 0: updatestring += f"{newgame.last_update[1]} runs scored!" @@ -486,7 +490,7 @@ async def watch_game(channel, game): newgame.gamestate_update_full() pause -= 1 - await asyncio.sleep(6) + await asyncio.sleep(2) title_string = f"{newgame.teams['away'].name} at {newgame.teams['home'].name} ended after {newgame.inning-1} innings" if (newgame.inning - 1) > newgame.max_innings: #if extra innings From af59437abed53b9b2b259143e718cf530e375b07 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Dec 2020 02:12:45 -0500 Subject: [PATCH 07/12] disable debug speed --- the_prestige.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/the_prestige.py b/the_prestige.py index 20cad60..081a93d 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -490,7 +490,7 @@ async def watch_game(channel, game): newgame.gamestate_update_full() pause -= 1 - await asyncio.sleep(2) + await asyncio.sleep(6) title_string = f"{newgame.teams['away'].name} at {newgame.teams['home'].name} ended after {newgame.inning-1} innings" if (newgame.inning - 1) > newgame.max_innings: #if extra innings From fc6cffe13228aef6ab0da54e771d5744a83a3c78 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Dec 2020 02:44:40 -0500 Subject: [PATCH 08/12] tried to fix the groundouts leaving first occupied bug --- games.py | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/games.py b/games.py index 32f2923..03ffe40 100644 --- a/games.py +++ b/games.py @@ -198,11 +198,12 @@ class game(object): outcome["runners"] = runners #list of consecutive baserunners: (base number, player object) if self.outs < 2 and len(runners) > 1: #fielder's choice replaces not great groundouts if any forceouts are present + def_stat = random_star_gen("defense_stars", defender) if -1.5 <= hitnum and hitnum < 0.5: #poorly hit groundouts outcome["text"] = appearance_outcomes.fielderschoice outcome["defender"] = "" - if 2.5 <= hitnum: #well hit flyouts can lead to sacrifice flies/advanced runners + if 2.5 <= hitnum and self.outs < 2: #well hit flyouts can lead to sacrifice flies/advanced runners if self.bases[2] is not None or self.bases[3] is not None: outcome["advance"] = True else: @@ -268,7 +269,16 @@ class game(object): self.bases[2] = None if self.bases[1] is not None: #double plays set this to None before this call run_roll = random.gauss(math.erf(random_star_gen("baserunning_stars", self.bases[1])-def_stat)-.5,1.5) - if run_roll > 1: + if run_roll < 1 or self.bases[2] is not None: #if runner can't make it or if baserunner blocking on second, convert to fielder's choice + outcome["text"] == appearance_outcomes.fielderschoice + runners = [(0,self.get_batter())] + for base in range(1,4): + if self.bases[base] == None: + break + runners.append((base, self.bases[base])) + outcome["runners"] = runners #rebuild consecutive runners + return runs + self.baserunner_check(defender, outcome) #run again as fielder's choice instead + else: self.bases[2] = self.bases[1] self.bases[1] = None return runs @@ -380,21 +390,24 @@ class game(object): elif result["text"] == appearance_outcomes.doubleplay: self.get_pitcher().game_stats["outs_pitched"] += 2 self.outs += 2 - self.bases[1] = None - scores_to_add += self.baserunner_check(defender, result) - self.get_batter().game_stats["rbis"] -= scores_to_add #remove the fake rbi from the player in advance + self.bases[1] = None + if self.outs < 3: + scores_to_add += self.baserunner_check(defender, result) + self.get_batter().game_stats["rbis"] -= scores_to_add #remove the fake rbi from the player in advance - elif result["text"] == appearance_outcomes.fielderschoice: + elif result["text"] == appearance_outcomes.fielderschoice or result["text"] == appearance_outcomes.groundout: self.get_pitcher().game_stats["outs_pitched"] += 1 self.outs += 1 - scores_to_add += self.baserunner_check(defender, result) + if self.outs < 3: + scores_to_add += self.baserunner_check(defender, result) elif "advance" in result.keys(): self.get_pitcher().game_stats["outs_pitched"] += 1 self.outs += 1 - if self.bases[3] is not None: - self.get_batter().game_stats["sacrifices"] += 1 - scores_to_add += self.baserunner_check(defender, result) + if self.outs < 3: + if self.bases[3] is not None: + self.get_batter().game_stats["sacrifices"] += 1 + scores_to_add += self.baserunner_check(defender, result) elif result["text"] == appearance_outcomes.strikeoutlooking or result["text"] == appearance_outcomes.strikeoutswinging: self.get_pitcher().game_stats["outs_pitched"] += 1 @@ -402,11 +415,6 @@ class game(object): self.get_batter().game_stats["strikeouts_taken"] += 1 self.get_pitcher().game_stats["strikeouts_given"] += 1 - elif result["text"] == appearance_outcomes.groundout: - self.get_pitcher().game_stats["outs_pitched"] += 1 - self.outs += 1 - scores_to_add += self.baserunner_check(defender, result) - else: self.get_pitcher().game_stats["outs_pitched"] += 1 self.outs += 1 From 15f7adb91633530504753f45f928a46408ec1643 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Dec 2020 02:58:41 -0500 Subject: [PATCH 09/12] adjusted the groundout/fielder's choice ratio --- games.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games.py b/games.py index 03ffe40..376898a 100644 --- a/games.py +++ b/games.py @@ -199,7 +199,7 @@ class game(object): if self.outs < 2 and len(runners) > 1: #fielder's choice replaces not great groundouts if any forceouts are present def_stat = random_star_gen("defense_stars", defender) - if -1.5 <= hitnum and hitnum < 0.5: #poorly hit groundouts + if -1.5 <= hitnum and hitnum < -0.5: #poorly hit groundouts outcome["text"] = appearance_outcomes.fielderschoice outcome["defender"] = "" From 7858e92852125564c0820bcd01f39d31b630f7b4 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Dec 2020 03:00:29 -0500 Subject: [PATCH 10/12] have bot remove reactions to page flipping --- the_prestige.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/the_prestige.py b/the_prestige.py index 081a93d..22e1c43 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -641,8 +641,10 @@ async def team_pages(msg, all_teams, search_term=None): react, user = await client.wait_for('reaction_add', timeout=60.0, check=react_check) if react.emoji == "◀" and current_page > 0: current_page -= 1 + react.remove(user) elif react.emoji == "▶" and current_page < (page_max-1): current_page += 1 + react.remove(user) await teams_list.edit(embed=pages[current_page]) except asyncio.TimeoutError: return From 56a1c38cc510ff1079ba55e8c3a75409d03d3cfc Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Dec 2020 03:16:19 -0500 Subject: [PATCH 11/12] adjusted how often runners advance on outs --- games.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/games.py b/games.py index 376898a..cfad85e 100644 --- a/games.py +++ b/games.py @@ -239,8 +239,8 @@ class game(object): self.bases[3] = None runs = 1 if self.bases[2] is not None: - run_roll = random.gauss(math.erf(random_star_gen("baserunning_stars", self.bases[2])-def_stat)-.5,1.5) - if run_roll > 0: + run_roll = random.gauss(2*math.erf((random_star_gen("baserunning_stars", self.bases[2])-def_stat)/4)-1,3) + if run_roll > 2: self.bases[3] = self.bases[2] self.bases[2] = None return runs @@ -263,13 +263,13 @@ class game(object): runs += 1 self.bases[3] = None if self.bases[2] is not None: - run_roll = random.gauss(math.erf(random_star_gen("baserunning_stars", self.bases[2])-def_stat)-.5,1.5) - if run_roll > 0: + run_roll = random.gauss(2*math.erf((random_star_gen("baserunning_stars", self.bases[2])-def_stat)/4)-1,3) + if run_roll > 1.5: self.bases[3] = self.bases[2] self.bases[2] = None if self.bases[1] is not None: #double plays set this to None before this call - run_roll = random.gauss(math.erf(random_star_gen("baserunning_stars", self.bases[1])-def_stat)-.5,1.5) - if run_roll < 1 or self.bases[2] is not None: #if runner can't make it or if baserunner blocking on second, convert to fielder's choice + run_roll = random.gauss(2*math.erf((random_star_gen("baserunning_stars", self.bases[1])-def_stat)/4)-1,3) + if run_roll < 2 or self.bases[2] is not None: #if runner can't make it or if baserunner blocking on second, convert to fielder's choice outcome["text"] == appearance_outcomes.fielderschoice runners = [(0,self.get_batter())] for base in range(1,4): From 929e095f9b20f42c2d2c0de02176394df2393f43 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Dec 2020 03:21:48 -0500 Subject: [PATCH 12/12] fixed the reaction remove --- the_prestige.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index 22e1c43..e23ad70 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -641,10 +641,10 @@ async def team_pages(msg, all_teams, search_term=None): react, user = await client.wait_for('reaction_add', timeout=60.0, check=react_check) if react.emoji == "◀" and current_page > 0: current_page -= 1 - react.remove(user) + await react.remove(user) elif react.emoji == "▶" and current_page < (page_max-1): current_page += 1 - react.remove(user) + await react.remove(user) await teams_list.edit(embed=pages[current_page]) except asyncio.TimeoutError: return