aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/valentines
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2021-08-10 14:15:51 +0100
committerGravatar Chris Lovering <[email protected]>2021-08-10 14:15:51 +0100
commitc334c20c03d4f3961c9b2628660efaae405e5d9c (patch)
treea4a89bd7799f65a25ac247a2037349d6ef25a51f /bot/exts/valentines
parentRequire both members used in love calculator have opt-ed into lovefest (diff)
Sort the members before calculating a love score
This ensures the same result for same input, regardless of order
Diffstat (limited to 'bot/exts/valentines')
-rw-r--r--bot/exts/valentines/lovecalculator.py3
1 files changed, 2 insertions, 1 deletions
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):