Skip to content

Commit

Permalink
feat(exts/fun): Add findblock command
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Aug 19, 2024
1 parent 4c1e957 commit 7c78f26
Show file tree
Hide file tree
Showing 5 changed files with 535 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- [**Fixed**] `>colour` command always return incorrect value
- [**Added**] Add loot table choice to `>barter` command
- [**Added**] Add `>findblock` command

### Internal Changes
- [**Added**] Add `ClampedRange` to revert some command's old range behaviour
Expand Down
25 changes: 24 additions & 1 deletion src/zibot/exts/fun/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import get_args

import discord
from discord import app_commands
from discord import app_commands, PartialEmoji
from discord.app_commands import Choice
from discord.app_commands import locale_str as _
from discord.ext import commands
Expand All @@ -23,6 +23,7 @@
from ...core.mixin import CogMixin
from ...utils.api import reddit
from ...utils.piglin import Piglin
from ...utils.ugbc import UGBC
from ._flags import FINDSEED_MODES, FindseedFlags


Expand All @@ -35,6 +36,7 @@ class Fun(commands.Cog, CogMixin):
def __init__(self, bot):
super().__init__(bot)
self.reddit = reddit.Reddit(self.bot.session)
self.ugbc = UGBC()

@cmds.command(
name=_("meme"),
Expand Down Expand Up @@ -457,3 +459,24 @@ def emoji(name: str):
async def lootTableSuggestion(self, inter, choice):
rps = (("Before Nerf", "before"), ("After Nerfed", "nerfed"))
return [app_commands.Choice(name=i[0], value=i[1]) for i in rps]

@cmds.command(
name=_("findblock"),
description=_("findblock-desc"),
aliases=("fblk",),
hybrid=True,
extras=dict(
example=("findblock", "fblk"),
),
)
@commands.cooldown(5, 25, commands.BucketType.user)
async def findblock(self, ctx):
result = self.ugbc.randomize()
missing = PartialEmoji.from_str("<:missingtexture:807536928361545729>")
e = ZEmbed(
ctx,
title="UGBC",
description=f"{missing} ({result.id})",
colour=discord.Color.yellow(),
).set_footer(text="Work in Progress")
await ctx.try_reply(embeds=[e])
2 changes: 2 additions & 0 deletions src/zibot/locale/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ findseed-result-classic = <@{ $userId }> -> Your seed is a { $eyeCount ->
[one] **{ $eyeCount }** eye
*[other] **{ $eyeCount }** eyes
}
findblock = findblock
findblock-desc = Try your luck with MCBE's UGBC
httpcat = httpcat
httpcat-desc = Get http status code with cat in it
pp = pp
Expand Down
Loading

0 comments on commit 7c78f26

Please sign in to comment.