From 431a138658b55916fc7db677cfb199cf84a8cb51 Mon Sep 17 00:00:00 2001 From: Chev <11602755+chev2@users.noreply.github.com> Date: Sat, 27 Jun 2020 22:29:17 -0700 Subject: [PATCH] Sort IDs by digit length --- tf2_voice_ban_bots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tf2_voice_ban_bots.py b/tf2_voice_ban_bots.py index a43d5db..894a307 100644 --- a/tf2_voice_ban_bots.py +++ b/tf2_voice_ban_bots.py @@ -85,7 +85,7 @@ while mergefilequery not in ("y", "n"): print("Skipping merge step...") dupe_number = len(players) - len(set(players)) #get number of duplicates -players = set(players) #remove duplicates in case of merging +players = sorted(set(players), key=lambda x: len(x)) #remove duplicates in case of merging, also sort by ID length (the voice_ban.dt file will break if not sorted) players_as_string = "\x01\0\0\0" + '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'.join(players) + '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' #this is how the voice_ban.dt file is patterned