From 2c44c378eb2717bdb5b6a5de7628d8dfb4835036 Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Sun, 8 Dec 2024 14:19:55 +0100 Subject: util: add findblock command --- cogs/utils.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cogs') diff --git a/cogs/utils.py b/cogs/utils.py index 02c17f3..d798f30 100755 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -96,6 +96,13 @@ class Utils(commands.Cog): self.bot = bot self.tries = 1 self.pins = [] + self.block_stats = [] + + with open("./required_block_states.json") as file: + required_block_states = json.load(file) + for block, states in required_block_states["minecraft"].items(): + for s in states: + self.block_stats.append(block) @commands.command( description="Pong!", @@ -105,6 +112,21 @@ class Utils(commands.Cog): async def ping(self, ctx): await ctx.send(f"Pong! {round(self.bot.latency*1000)}ms") + @commands.cooldown(1, 25, commands.BucketType.guild) + @commands.command() + async def findblock(self, ctx): + """Simulate the UGBC experience""" + if ctx.message.channel.id != int( + self.bot.config[str(ctx.message.guild.id)]["bot_channel"] + ): + await ctx.message.delete() + ctx.command.reset_cooldown(ctx) + return + + await ctx.send( + f"{discord.utils.escape_mentions(ctx.message.author.display_name)} -> your block is a {choice(self.block_stats)}." + ) + @commands.cooldown(1, 25, commands.BucketType.guild) @commands.command() async def findseed(self, ctx): -- cgit v1.2.3