From 9ef2acf34c44694ae2b010039066fc5a99053be5 Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Sun, 10 Jul 2022 21:51:19 -0400 Subject: [PATCH 1/4] Capping user names to 12 characters because runescape names. Will need to revisit user name limit later. --- utilities/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utilities/utils.py b/utilities/utils.py index 11750e7..a328b87 100644 --- a/utilities/utils.py +++ b/utilities/utils.py @@ -82,6 +82,9 @@ async def submit_score( else: config_category = category + # capping to 12 characters because runescape names are 12 characters long. + user = user[:12] + # create score tuple for either time or int # define sort index if highscores_config["categories"][config_category]["is_time_record"]: From 115e3dd3d09baf43c0404825a0da84b42043a3cf Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Sun, 10 Jul 2022 21:59:11 -0400 Subject: [PATCH 2/4] Shortening the pad size for messages a little. --- utilities/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utilities/utils.py b/utilities/utils.py index a328b87..cf860c9 100644 --- a/utilities/utils.py +++ b/utilities/utils.py @@ -21,7 +21,7 @@ def format_highscore_message(boss_name: str): # Gather all categories and add to string for key, value in boss_data["categories"].items(): - ret_string += f"{key}".ljust(30, " ") + ret_string += f"{key}".ljust(25, " ") ret_string += "\n" highscore_size = highscores_config["highscore_size"] @@ -31,9 +31,9 @@ def format_highscore_message(boss_name: str): for key, value in boss_data["categories"].items(): if len(value) > i: score = value[i] - ret_string += f"{i+1}: {score[0]} - {score[1]}".ljust(30, " ") + ret_string += f"{i+1}: {score[0]} - {score[1]}".ljust(25, " ") else: - ret_string += f"{i+1}: submit your score".ljust(30, " ") + ret_string += f"{i+1}: submit your score".ljust(25, " ") ret_string += "\n" return ret_string + "```" From 8eeda141191f5853b9ecf5212e178dd430b5c890 Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Tue, 12 Jul 2022 15:15:37 -0400 Subject: [PATCH 3/4] Strip leading 0 and : from scores. --- utilities/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utilities/utils.py b/utilities/utils.py index cf860c9..66d63a3 100644 --- a/utilities/utils.py +++ b/utilities/utils.py @@ -85,6 +85,9 @@ async def submit_score( # capping to 12 characters because runescape names are 12 characters long. user = user[:12] + # strip leading zeros and colon from score + score = score.lstrip("0:") + # create score tuple for either time or int # define sort index if highscores_config["categories"][config_category]["is_time_record"]: From 9ba37c22bb89a4980a7d75d8f47001e311371304 Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Tue, 12 Jul 2022 15:18:59 -0400 Subject: [PATCH 4/4] Splitting username on pipe. --- utilities/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities/utils.py b/utilities/utils.py index 66d63a3..5a3bb9b 100644 --- a/utilities/utils.py +++ b/utilities/utils.py @@ -83,7 +83,8 @@ async def submit_score( config_category = category # capping to 12 characters because runescape names are 12 characters long. - user = user[:12] + # Splitting on pipe. My discord has multiple names on account split by pipe. + user = user.split("|")[0][:12] # strip leading zeros and colon from score score = score.lstrip("0:")