Skip to content

Commit

Permalink
Qeuue
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunarmagpie committed Nov 22, 2024
1 parent bb70000 commit 6a1cdf5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions bot/exts/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,31 @@ async def count(self: GameExt, ctx: ComponentContext) -> None:
async def update_status(self: GameExt) -> None:
"""Update the bots status."""
game_count: int = 0
queue_length: int = 0

for server in self.manager.servers:
game_count += await server.get_game_count()
queue_length += await server.get_queue_length()

if (game_count == 1):
game_word = "game"
else:
game_word = "games"

if (queue_length == 1):
queue_word = "player queued"
else:
queue_word = "players queued"

if (queue_length !== 0 && game_count !== 0):
message = f"{game_count} {game_word}, {queue_length} {queue_word}"
else:
message = f"{game_count} {game_word}"

await self.client.change_presence(
activity=Activity(
f"{game_count} {game_word}",
ActivityType.WATCHING,
,
ActivityType.CUSTOM,
self.manager.servers[0].server_url,
)
)
Expand Down

0 comments on commit 6a1cdf5

Please sign in to comment.