From 889e43398e7b9609a858abf1b35bd06ce4141c9d Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Tue, 14 May 2024 17:53:25 +0100 Subject: [PATCH] Adjust gay time --- src/cogs/gay_meter.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cogs/gay_meter.py b/src/cogs/gay_meter.py index 4fe5f0d..b6acf29 100644 --- a/src/cogs/gay_meter.py +++ b/src/cogs/gay_meter.py @@ -20,7 +20,7 @@ class MeterCog(commands.Cog): await ctx.respond("Calculating...") for i in range(0, 125, 25): await ctx.edit(content="Calculating... %d%%" % i) - await asyncio.sleep(random.randint(1, 30) / 10) + await asyncio.sleep(random.randint(1, 100) / 10) pct = user.id % 100 await ctx.edit(content=f"{user.mention} is {pct}% gay.") @@ -29,16 +29,27 @@ class MeterCog(commands.Cog): async def penis_meter(self, ctx: discord.ApplicationContext, user: discord.User = None): """Checks the length of someone's penis.""" user = user or ctx.user - n = random.randint(0, 100) + n = self.cache.get(user) or random.randint(0, 100) chunks = ["8"] chunks += ["="] * n chunks.append("B") + self.cache[user] = n return await ctx.respond( embed=discord.Embed( title=f"{user.display_name}'s penis length:", description="%d cm\n%s" % (n, "".join(chunks)) ) ) + + @commands.command() + @commands.is_owner() + async def clear_cache(self, ctx: commands.Context, user: discord.User = None): + """Clears the Meter cache""" + if not user: + self.cache = {} + else: + self.cache.pop(user, None) + return await ctx.message.add_reaction("\N{white heavy check mark}") def setup(bot):