aboutsummaryrefslogtreecommitdiff
path: root/cogs/utils.py
diff options
context:
space:
mode:
authorSamot19 <81269200+Samot19@users.noreply.github.com>2021-06-24 20:43:27 +0000
committerGitHub <noreply@github.com>2021-06-24 20:43:27 +0000
commita7fabb623259d0137bb1c8b19000c0c4ec12232b (patch)
tree7d1517c4cab51b10e73d0aa3e458e17beaae80b7 /cogs/utils.py
parent4266dc89c4df32950ae413b5afbe3f7dc73715f6 (diff)
downloadsteve-bot-a7fabb623259d0137bb1c8b19000c0c4ec12232b.tar
steve-bot-a7fabb623259d0137bb1c8b19000c0c4ec12232b.tar.gz
steve-bot-a7fabb623259d0137bb1c8b19000c0c4ec12232b.tar.bz2
steve-bot-a7fabb623259d0137bb1c8b19000c0c4ec12232b.tar.lz
steve-bot-a7fabb623259d0137bb1c8b19000c0c4ec12232b.tar.xz
steve-bot-a7fabb623259d0137bb1c8b19000c0c4ec12232b.tar.zst
steve-bot-a7fabb623259d0137bb1c8b19000c0c4ec12232b.zip
Readd stuff that was there.
Preview the changes before commiting smh.
Diffstat (limited to '')
-rwxr-xr-xcogs/utils.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/cogs/utils.py b/cogs/utils.py
index 8815d7a..8bffa43 100755
--- a/cogs/utils.py
+++ b/cogs/utils.py
@@ -523,14 +523,35 @@ class Utils(commands.Cog):
@commands.command()
async def fboard(self, ctx, requested: str = "streak"):
"""Show fair leaderboard (day or streak)."""
+ #Get fair object.
with open("fair.json", "r") as f:
fair = json.load(f)
#Detect people who didn't maintain their streak.
for user in fair:
- currentdate = datetime.datetime.now().date()
- if fair[user]["date"] != str(currentdate) and fair[user]["date"] != str(currentdate-datetime.timedelta(1)):
+ tz = fair[user]["timezone"]
+ try:
+ currentdate = datetime.datetime.now(timezone(tz)).date()
+ except:
+ # Ocean put in a test timezone and it messes with stuff
+ continue
+ if fair[user]["date"] != str(currentdate) and fair[user]["date"] != str(
+ currentdate - timedelta(1)
+ ):
fair[user]["streak"] = 1
+ fair[user]["date"] = str(currentdate)
+ try:
+ # It seems like people don't like spam pings
+
+ # await ctx.send(
+ # self.bot.get_user(int(user)).mention
+ # + ": You lost your streak! <:sad:716629485449117708>"
+ # )
+
+ pass
+ except:
+ # User left the server so the bot can't find them
+ continue
with open("fair.json", "w") as f:
json.dump(fair, f, indent=4)