Skip to content

Commit

Permalink
Fix old player check comparison for /move
Browse files Browse the repository at this point in the history
  • Loading branch information
Ooglely committed Dec 17, 2024
1 parent 5858e0e commit 0db4e63
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pug/pug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0db4e63

Please sign in to comment.