From a43739d8a1721631d059d9e391cddfbe9ca4d7e9 Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Wed, 1 Nov 2023 00:49:12 +0800 Subject: [PATCH] Update large.py - Fixed an issue where player lists could exceed 1024 characters --- discordgsm/styles/large.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/discordgsm/styles/large.py b/discordgsm/styles/large.py index 5ecae5c..18ee4e0 100644 --- a/discordgsm/styles/large.py +++ b/discordgsm/styles/large.py @@ -46,8 +46,8 @@ def add_player_list_fields(self, embed: Embed, field_name: str, players: List[Ga # Replace Markdown # https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline- - name = name.replace('*', '\\*').replace('_', '\\_').replace('~', - '\\~').replace('`', '\\`').replace('>', '\\>') + name = name.replace('*', '\\*').replace('_', '\\_').replace('~', '\\~') + name = name.replace('`', '\\`').replace('>', '\\>') + '\n' index = i % len(values) counts[index] += len(name) @@ -55,12 +55,12 @@ def add_player_list_fields(self, embed: Embed, field_name: str, players: List[Ga player_left = len(filtered_players) - player_count remaining_players_message = f'... {player_left} more player{"" if player_left <= 1 else "s"}' - # Embed must be 1024 or fewer in length. (Actually 1000) - if (counts[index] + len(remaining_players_message)) >= 1000: + # Embed must be 1024 or fewer in length. + if (counts[index] + len(remaining_players_message)) >= 1024: values[index] += remaining_players_message break - values[index] += f'{name}\n' + values[index] += name player_count += 1 for i, name in enumerate([field_name, empty_value, empty_value]):