diff --git a/pug/pug.py b/pug/pug.py index 482ebce..e8642c2 100644 --- a/pug/pug.py +++ b/pug/pug.py @@ -786,24 +786,27 @@ async def move( Player(discord=player.id) for player in red_players + blu_players ] # Check if game was already added to searcher - genned: bool = True last_players: list[PugPlayer] - timestamp: int + old_timestamp: int + player_matches: int = 0 try: - last_players, timestamp = await chosen_category.get_last_players( + last_players, old_timestamp = await chosen_category.get_last_players( interaction.guild.id ) except LookupError: last_players = [] - timestamp = round(time.time()) - 7200 - print(last_players) + for player in last_players: - if player.discord not in [ + if player.discord in [ int(player.id) for player in red_players + blu_players ]: - genned = False - break - if not genned: + player_matches += 1 + + if (not player_matches > (len(game_players) * 0.9)) or ( + round(time.time()) - old_timestamp > 21600 + ): + # This pug was likely not generated by the bot so we should add it to the searcher + timestamp = round(time.time()) - 7200 print("Adding game to searcher...") await LogSearcher.add_searcher_game( interaction.guild.id, chosen_category, game_players, timestamp