Skip to content

Commit

Permalink
Merge pull request #1 from Tyrannicodin/api-chagnes
Browse files Browse the repository at this point in the history
Fix activity status, format
  • Loading branch information
zunda-arrow authored Nov 24, 2024
2 parents 8ab0032 + c402bbf commit 75ed720
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions bot/exts/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Extension,
Message,
OptionType,
PartialEmoji,
SlashContext,
component_callback,
slash_command,
Expand Down Expand Up @@ -103,17 +104,17 @@ async def update_status(self: GameExt) -> None:
game_count += await server.get_game_count()
queue_length += await server.get_queue_length()

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

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

if (queue_length != 0 and game_count != 0):
if queue_length != 0 and game_count != 0:
message = f"{game_count} {game_word}, {queue_length} {queue_word}"
else:
message = f"{game_count} {game_word}"
Expand All @@ -123,6 +124,8 @@ async def update_status(self: GameExt) -> None:
message,
ActivityType.CUSTOM,
self.manager.servers[0].server_url,
state=message,
emoji=PartialEmoji("1075864519399706754", "bdubs"),
)
)

Expand Down
2 changes: 1 addition & 1 deletion bot/util/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async def get_deck(self: Server, code: str) -> dict | None:
result = loads((await response.content.read()).decode())
except (TimeoutError, JSONDecodeError):
return None
if (result.status != 200):
if result.status != 200:
return None
return result

Expand Down

0 comments on commit 75ed720

Please sign in to comment.