Skip to content

Commit

Permalink
[BattleRoyale] use global name or display name
Browse files Browse the repository at this point in the history
  • Loading branch information
japandotorg committed Oct 15, 2023
1 parent b973fef commit 646bf23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions battleroyale/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ async def start(
emoji: discord.PartialEmoji = random.choice(EMOJIS)
prompts += "\n" + random.choice(PROMPTS).format(
emoji=custom_emoji if custom_emoji else emoji,
killer=f"**{killer.display_name}**",
killed=f"**{killed.display_name}**",
killer=f"**{killer.global_name or killer.display_name}**",
killed=f"**{killed.global_name or killed.display_name}**",
)
if len(self.players) <= 30 or len(self.remaining_players) <= 2 or i >= 2:
start = time.time()
Expand Down Expand Up @@ -152,7 +152,7 @@ async def start(
winner = self.remaining_players[0]
places.insert(0, winner)
places_text = "".join(
f"**#{index}** - {player.display_name} - {kills[player]} kill{'s' if kills[player] > 1 else ''}\n"
f"**#{index}** - {player.global_name or player.display_name} - {kills[player]} kill{'s' if kills[player] > 1 else ''}\n"
for index, player in enumerate(places[:10], start=1)
)
places_text = list(pagify(places_text, page_length=2000))[0]
Expand Down
5 changes: 4 additions & 1 deletion battleroyale/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ async def _callback(
self: RemainingPlayerButton, interaction: discord.Interaction[Red]
) -> None:
remaining_player_str = humanize_list(
[m.display_name for m in sorted(self.view.remaining, key=lambda m: m.display_name)]
[
m.global_name or m.display_name
for m in sorted(self.view.remaining, key=lambda m: m.global_name or m.display_name)
]
)
remaining_players_str = (
f"{remaining_player_str[:4000]}..."
Expand Down

0 comments on commit 646bf23

Please sign in to comment.