add vote streaks
@@ -4,6 +4,7 @@ import classyjson as cj
import aiohttp # ~~aiohttp makes me ****~~
import asyncio
import discord
+import arrow
class Webhooks(commands.Cog):
@@ -90,6 +91,26 @@ class Webhooks(commands.Cog):
amount *= len(self.d.mining.pickaxes) - self.d.mining.pickaxes.index(await self.db.fetch_pickaxe(int(data.user)))
+ db_user = await self.db.fetch_user(uid)
+
+ streak_time = db_user['streak_time']
+ vote_streak = db_user['vote_streak']
+
+ if streak_time is None: # time
+ streak_time = 0
+
+ if arrow.utcnow().shift(days=-1) > arrow.get(streak_time): # vote expired
+ vote_streak = 0
+
+ vote_streak_extra = int((5 if vote_streak > 5 else vote_streak)/2)
+ if vote_streak_extra < 1:
+ vote_streak_extra = 1
+
+ amount *= vote_streak_extra
+
+ await self.db.update_user(uid, 'last_vote', arrow.utcnow().timestamp)
+ await self.db.update_user(uid, 'vote_streak', vote_streak+1)
+
await self.reward(uid, amount)
