aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons
diff options
context:
space:
mode:
authorGravatar Suhail <[email protected]>2019-03-19 23:09:42 +0000
committerGravatar Suhail <[email protected]>2019-03-19 23:09:42 +0000
commit722ed131b59982caf8e54ca8bfbc36989ec2aae4 (patch)
treeb3f242431a2756672a7eeedb28b40d3d2569e3e2 /bot/seasons
parentSpooky Rating (diff)
Spooky Rating - Fixed Requested Changes
- Removed the documentation on how Users are converted - Changed random to a local state rather than using global seed - Changed the JSON minimum to -1 due to how bisect works
Diffstat (limited to 'bot/seasons')
-rw-r--r--bot/seasons/halloween/spookyrating.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/bot/seasons/halloween/spookyrating.py b/bot/seasons/halloween/spookyrating.py
index 92f71b9e..8c4f1b12 100644
--- a/bot/seasons/halloween/spookyrating.py
+++ b/bot/seasons/halloween/spookyrating.py
@@ -23,6 +23,7 @@ class SpookyRating:
def __init__(self, bot):
self.bot = bot
+ self.local_random = random.Random()
@commands.command()
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
@@ -30,14 +31,6 @@ class SpookyRating:
"""
Calculates the spooky rating of someone.
- This command accepts an optional user as an argument, defaulting to the command executor.
- Users are converted from:
- - User ID
- - Mention
- - name#discrim
- - name
- - nickname
-
Any user will always yield the same result, no matter who calls the command
"""
@@ -45,9 +38,8 @@ class SpookyRating:
who = ctx.author
# This ensures that the same result over multiple runtimes
- random.seed(who.id)
-
- spooky_percent = random.randint(1, 100)
+ self.local_random.seed(who.id)
+ spooky_percent = self.local_random.randint(1, 101)
# We need the -1 due to how bisect returns the point
# see the documentation for further detail