From c334c20c03d4f3961c9b2628660efaae405e5d9c Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 10 Aug 2021 14:15:51 +0100 Subject: Sort the members before calculating a love score This ensures the same result for same input, regardless of order --- bot/exts/valentines/lovecalculator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/exts/valentines/lovecalculator.py b/bot/exts/valentines/lovecalculator.py index ba5e0b92..d06d883d 100644 --- a/bot/exts/valentines/lovecalculator.py +++ b/bot/exts/valentines/lovecalculator.py @@ -65,7 +65,8 @@ class LoveCalculator(Cog): # This has to be done manually to be applied to usernames return clean_content(escape_markdown=True).convert(ctx, arg) - who, whom = [await normalize(arg) for arg in (who, whom)] + # Sort to ensure same result for same input, regardless of order + who, whom = sorted([await normalize(arg) for arg in (who, whom)]) # Make sure user didn't provide something silly such as 10 spaces if not (who and whom): -- cgit v1.2.3