コード例 #1
0
ファイル: fun.py プロジェクト: quaackk/Villager-Bot
    async def cursed_mc(self, ctx):
        if random.choice((True, False)):
            meme = {"nsfw": True, "spoiler": True}

            async with ctx.typing():
                while meme["spoiler"] or meme["nsfw"] or meme.get("image") is None:
                    resp = await self.bot.aiohttp.get(
                        "https://api.iapetus11.me/reddit/cursedminecraft",
                        headers={"Authorization": self.k.villager_api},
                        params={"queryId": ctx.channel.id},
                    )

                    meme = cj.classify(await resp.json())

            embed = discord.Embed(color=self.d.cc, title=meme.title[:256], url=meme.permalink)

            embed.set_footer(text=f"{meme.upvotes}  |  u/{meme.author}", icon_url=self.d.upvote_emoji_image)
            embed.set_image(url=meme.image)

            await ctx.send(embed=embed)
        else:
            embed = discord.Embed(color=self.d.cc)
            embed.set_image(url=f"https://iapetus11.me/static/images/cursed_minecraft/{random.choice(self.d.cursed_images)}")

            await ctx.send(embed=embed)
コード例 #2
0
ファイル: webhooks.py プロジェクト: Mrdemolisher/Villager-Bot
        async def handler(req):
            if req.headers.get("Authorization") == self.k.topgg_webhook:
                self.bot.dispatch("topgg_event", cj.classify(await req.json()))
            else:
                return web.Response(status=401)

            return web.Response()
コード例 #3
0
ファイル: fun.py プロジェクト: quaackk/Villager-Bot
    async def meme(self, ctx):
        """Sends a meme from reddit"""

        do_nsfw = False

        if isinstance(ctx.channel, discord.TextChannel):
            do_nsfw = ctx.channel.is_nsfw()

        meme = {"nsfw": True, "spoiler": True}

        async with ctx.typing():
            while meme["spoiler"] or (not do_nsfw and meme["nsfw"]) or meme.get("image") is None:
                resp = await self.aiohttp.get(
                    "https://api.iapetus11.me/reddit/meme",
                    headers={"Authorization": self.k.villager_api},
                    params={"queryId": ctx.channel.id},
                )

                meme = cj.classify(await resp.json())

        embed = discord.Embed(color=self.d.cc, title=meme.title[:256], url=meme.permalink)

        embed.set_footer(text=f"{meme.upvotes}  |  u/{meme.author}", icon_url=self.d.upvote_emoji_image)
        embed.set_image(url=meme.image)

        await ctx.send(embed=embed)
コード例 #4
0
ファイル: fun.py プロジェクト: candyiscoolal/Villager-Bot
    async def meme(self, ctx):
        """Sends a meme from reddit"""

        do_nsfw = False
        if isinstance(ctx.channel, discord.TextChannel):
            do_nsfw = ctx.channel.is_nsfw()

        meme = {'nsfw': True, 'spoiler': True}

        async with ctx.typing():
            while meme['spoiler'] or (
                    not do_nsfw and meme['nsfw']) or meme.get('image') is None:
                resp = await self.ses.get(
                    'https://api.iapetus11.me/reddit/gimme/meme+memes+me_irl+dankmemes+wholesomememes+prequelmemes',
                    headers={'Authorization': self.k.vb_api})

                meme = cj.classify(await resp.json())

        embed = discord.Embed(color=self.d.cc,
                              title=f'{meme.title}',
                              url=meme.permalink)

        embed.set_footer(
            text=f'{meme.upvotes}  |  u/{meme.author}',
            icon_url=self.bot.get_emoji(
                int(self.d.emojis.updoot.split(':')[-1].replace('>', ''))).url)
        embed.set_image(url=meme.image)

        await ctx.send(embed=embed)
コード例 #5
0
        async def handler(req):
            if req.headers.get('Authorization') == self.d.topgg_hooks_auth:
                self.bot.dispatch('topgg_event', cj.classify(await req.json()))
            else:
                return web.Response(status=401)

            return web.Response()
コード例 #6
0
ファイル: fun.py プロジェクト: Mrdemolisher/Villager-Bot
    async def meme(self, ctx):
        """Sends a meme from reddit"""

        do_nsfw = False
        if isinstance(ctx.channel, discord.TextChannel):
            do_nsfw = ctx.channel.is_nsfw()

        meme = {"nsfw": True, "spoiler": True}

        async with ctx.typing():
            while meme["spoiler"] or (
                    not do_nsfw and meme["nsfw"]) or meme.get("image") is None:
                resp = await self.ses.get(
                    "https://api.iapetus11.me/reddit/gimme/meme+memes+me_irl+dankmemes+wholesomememes+prequelmemes",
                    headers={"Authorization": self.k.vb_api},
                )

                meme = cj.classify(await resp.json())

        embed = discord.Embed(color=self.d.cc,
                              title=meme.title[:256],
                              url=meme.permalink)

        embed.set_footer(
            text=f"{meme.upvotes}  |  u/{meme.author}",
            icon_url=self.bot.get_emoji(
                int(self.d.emojis.updoot.split(":")[-1].replace(">", ""))).url,
        )
        embed.set_image(url=meme.image)

        await ctx.send(embed=embed)
コード例 #7
0
ファイル: misc.py プロジェクト: candyiscoolal/Villager-Bot
def recursive_update(
        obj, new):  # hOlY F*****G SHIT this is so big brained I AM A GOD
    if isinstance(obj, dict) and isinstance(new, dict):
        for k, v in new.items():
            obj[k] = recursive_update(obj.get(k, cj.classify({})), v)
    elif isinstance(obj, list) and isinstance(new, list):
        obj = [
        ]  # obj here needs to be reset to zero to avoid weird list issues (see /update command in cogs/cmds/owner.py)
        for i, v in enumerate(new):
            obj.append(recursive_update(obj[i], v) if i < len(obj) else v)
    else:
        return new

    return obj
コード例 #8
0
ファイル: owner.py プロジェクト: Mrdemolisher/Villager-Bot
    async def update(self, ctx, thing):
        if thing.lower() == "data":
            async with aiofiles.open("data/data.json", "r", encoding="utf8") as d:
                self.d = recursive_update(self.d, cj.loads(await d.read()))

            self.d.findables = cj.classify(self.d.special_findables + self.d.default_findables)
        elif thing.lower() == "text":
            async with aiofiles.open("data/text.json", "r", encoding="utf8") as t:  # recursive shit not needed here
                self.bot.langs.update(cj.loads(await t.read()))
        elif thing.lower() == "mcservers":
            self.d.additional_mcservers = await self.db.fetch_all_mcservers()
        else:
            await self.bot.send(ctx, 'Invalid, options are "data", "text", or "mcservers"')
            return

        await ctx.message.add_reaction(self.d.emojis.yes)
コード例 #9
0
    async def update(self, ctx, thing):
        if thing.lower() == 'data':
            with open('data/data.json', 'r', encoding='utf8') as d:
                self.d = recursive_update(self.d, cj.load(d))

            self.d.findables = cj.classify(self.d.special_findables +
                                           self.d.default_findables)
        elif thing.lower() == 'text':
            with open('data/text.json', 'r',
                      encoding='utf8') as t:  # recursive shit not needed here
                self.bot.langs.update(cj.load(t))
        elif thing.lower() == 'mcservers':
            self.d.additional_mcservers = await self.db.fetch_all_mcservers()
        else:
            await self.bot.send(
                ctx, 'Invalid, options are "data", "text", or "mcservers"')
            return

        await ctx.message.add_reaction(self.d.emojis.yes)
コード例 #10
0
    async def minecraft_profile(self, ctx, player):
        if 17 > len(player) > 1 and player.lower().strip('abcdefghijklmnopqrstuvwxyz1234567890_') == '':
            with ctx.typing():
                res = await self.ses.get(f'https://api.mojang.com/users/profiles/minecraft/{player}')

            if res.status == 204:
                await self.bot.send(ctx, ctx.l.minecraft.invalid_player)
                return
            elif res.status != 200:
                await self.bot.send(ctx, ctx.l.minecraft.profile.error)
                return

            jj = await res.json()
            uuid = jj['id']
        elif len(player) in (32, 36,) and player.lower().strip('abcdefghijklmnopqrstuvwxyz1234567890-') == '':  # player is a uuid
            uuid = player.replace('-', '')
        else:
            await self.bot.send(ctx, ctx.l.minecraft.invalid_player)
            return

        with ctx.typing():
            resps = await asyncio.gather(
                self.ses.get(f'https://api.mojang.com/user/profiles/{uuid}/names'),
                self.ses.get(f'https://sessionserver.mojang.com/session/minecraft/profile/{uuid}')
            )

        for res in resps:
            if res.status == 204:
                await self.bot.send(ctx, ctx.l.minecraft.invalid_player)
                return
            elif res.status != 200:
                await self.bot.send(ctx, ctx.l.minecraft.profile.error)
                return

        names = cj.classify(await resps[0].json())
        profile = cj.classify(await resps[1].json())

        skin_url = None
        cape_url = None

        for prop in profile['properties']:
            if prop['name'] == 'textures':
                textures = cj.loads(base64.b64decode(prop['value'])).textures
                skin_url = textures.get('SKIN', {}).get('url')
                cape_url = textures.get('CAPE', {}).get('url')
                break

        name_hist = '\uFEFF'

        for i, name in enumerate(reversed(names)):
            time = name.get('changedToAt')

            if time is None:
                time = ctx.l.minecraft.profile.first
            else:
                time = arrow.Arrow.fromtimestamp(time)
                time = time.format('MMM D, YYYY', locale=ctx.l.lang) + ', ' + time.humanize(locale=ctx.l.lang)

            name_hist += f'**{len(names)-i}.** `{name.name}` - {time}\n'

        embed = discord.Embed(color=self.d.cc, title=ctx.l.minecraft.profile.mcpp.format(profile.name))

        if skin_url is not None:
            embed.description = f'[**{ctx.l.minecraft.profile.skin}**]({skin_url})'

        if cape_url is not None:
            embed.description += f' | [**{ctx.l.minecraft.profile.cape}**]({cape_url})'
        else:
            embed.description += f' | {ctx.l.minecraft.profile.nocape}'

        embed.set_thumbnail(url=f'https://visage.surgeplay.com/head/{uuid}.png')

        embed.add_field(name=':link: UUID', value=f'`{uuid[:8]}-{uuid[8:12]}-{uuid[12:16]}-{uuid[16:20]}-{uuid[20:]}`\n`{uuid}`', inline=False)
        embed.add_field(name=(':label: ' + ctx.l.minecraft.profile.hist), value=name_hist, inline=False)

        await ctx.send(embed=embed)
コード例 #11
0

atexit.register(exit_handler)

while True:
    res = requests.get(
        f"https://api.groupme.com/v3/groups/{config.group_id}/messages",
        params={
            "since_id": last_msg_id,
            "token": config.groupme_token,
            "limit": 10
        },
    )

    if res.status_code == 200:
        jj = cj.classify(res.json())

        for i, msg in enumerate(reversed(jj.response.messages)):
            content = msg.text

            res = requests.post(
                config.webhook,
                data={
                    "username":
                    msg.name,
                    "avatar_url":
                    msg.avatar_url,
                    "content": (msg.text if msg.text else "​") +
                    "\n".join(a.url
                              for a in msg.attachments if a.type == "image")
                    # "embeds": [{"image": {"url": a.url}} for a in msg.attachments if a.type == "image"],
コード例 #12
0
    async def spawn_event(self, ctx):
        try:
            await asyncio.sleep(random.randint(1, 200)/100)

            if ctx.guild is None:
                return

            db_guild = await self.db.fetch_guild(ctx.guild.id)
            diff = db_guild['difficulty']

            if diff == 'peaceful': return

            # difficulty multiplier
            diff_multi = 1.5 if diff == 'hard' else 1

            # type of mob that will be spawned, just a string
            mob_key = random.choice(list(self.d.mobs_mech.mobs))

            mob = self.d.mobs_mech.mobs[mob_key].copy()
            mob.update(ctx.l.mobs_mech.mobs[mob_key])
            mob = cj.classify(mob)

            embed = discord.Embed(
                color=self.d.cc,
                title=f'**{random.choice(ctx.l.mobs_mech.mob_drops).format(mob.nice.lower())}**',
                description='Do you want to `fight` the mob?'  # fight it you little baby
            )

            embed.set_image(url=mob.image)

            embed_msg = await ctx.send(embed=embed)

            while True:
                try:
                    engage_msg = await self.bot.wait_for('message', check=(lambda m: self.engage_check(m, ctx)), timeout=15)
                except asyncio.TimeoutError:
                    await embed_msg.edit(suppress=True)
                    return

                u = engage_msg.author
                u_db = await self.db.fetch_user(u.id)

                if u_db['health'] < 2:
                    await self.bot.send(ctx, ctx.l.mobs_mech.no_health)
                else:
                    break

            await embed_msg.edit(suppress=True)

            u_sword = await self.db.fetch_sword(u.id)
            slime_trophy = await self.db.fetch_item(u.id, 'Slime Trophy')

            self.d.pause_econ[u.id] = arrow.utcnow()  # used later on to clear pause_econ based on who's been in there for tooo long

            u_health = u_db['health']
            mob_max_health = mob.health

            iteration = 0

            while True:
                iteration += 1

                embed = discord.Embed(color=self.d.cc, title='Do you want to `attack` or `flee`?')
                embed.set_image(url=mob.image)

                embed.add_field(  # user health bar
                    name=f'**{u.display_name}**',
                    value=make_health_bar(u_health, 20, self.d.emojis.heart_full, self.d.emojis.heart_half, self.d.emojis.heart_empty),
                    inline=False
                )

                embed.add_field(  # mob health bar
                    name=f'**{mob.nice}**',
                    value=make_health_bar(
                        mob.health,
                        mob_max_health,
                        self.d.emojis.heart_full,
                        self.d.emojis.heart_half,
                        self.d.emojis.heart_empty
                    ),
                    inline=False
                )

                msg = await ctx.send(embed=embed)

                try:
                    resp = await self.bot.wait_for('message', check=(lambda m: self.attack_check(m, engage_msg)), timeout=15)  # wait for response
                except asyncio.TimeoutError:  # user didn't respond
                    await msg.edit(suppress=True)

                    self.d.pause_econ.pop(u.id, None)
                    await self.db.update_user(u.id, 'health', u_health)

                    await self.bot.send(ctx, random.choice(ctx.l.mobs_mech.flee_insults))

                    return

                if resp.content.lower() in self.d.mobs_mech.valid_flees:  # user decides to not fight mob anymore cause they a little baby
                    await msg.edit(suppress=True)

                    self.d.pause_econ.pop(u.id, None)
                    await self.db.update_user(u.id, 'health', u_health)

                    await self.bot.send(ctx, random.choice(ctx.l.mobs_mech.flee_insults))

                    return

                u_dmg = await self.calc_sword_damage(u.id, u_sword, diff_multi)  # calculate damage

                if mob_key == 'baby_slime':
                    if iteration < 3 and slime_trophy is None:
                        u_dmg = 0
                    elif slime_trophy is not None and random.choice((True, False, False,)):
                        u_dmg = 0
                    elif iteration >= 3 and random.choice((True, False,)):
                        u_dmg = 0

                mob.health -= u_dmg

                if mob.health < 1:  # user wins
                    self.d.pause_econ.pop(u.id, None)
                    await self.bot.send(ctx, random.choice(ctx.l.mobs_mech.user_finishers).format(mob.nice.lower(), u_sword.lower()))
                    break
                else:
                    if mob_key == 'baby_slime' and u_dmg == 0:
                        await self.bot.send(ctx, random.choice(mob.misses).format(u_sword.lower()))
                    else:
                        await self.bot.send(ctx, random.choice(ctx.l.mobs_mech.user_attacks).format(mob.nice.lower(), u_sword.lower()))  # user attack message

                await asyncio.sleep(1)

                m_dmg = random.randint(2, 6)

                if mob_key == 'creeper':
                    if iteration > 2:
                        if random.choice((True, False, False)):
                            self.d.pause_econ.pop(u.id, None)

                            u_health = 0

                            await self.bot.send(ctx, random.choice(mob.finishers))
                            break

                    m_dmg = 0

                u_health -= m_dmg

                if u_health < 1:  # mob wins
                    self.d.pause_econ.pop(u.id, None)
                    await self.bot.send(ctx, random.choice(mob.finishers))
                    break
                else:
                    await self.bot.send(ctx, random.choice(mob.attacks))

                await asyncio.sleep(1.75)

                await msg.edit(suppress=True)

            await msg.edit(suppress=True)  # remove old Message

            embed = discord.Embed(color=self.d.cc)  # create new embed which shows health to show that user has lost / won
            embed.set_image(url=mob.image)

            # if u_health == 1: u_health = 2
            # if mob.health == 1: mob.health = 2

            # if u_health < 1 or mob.health < 1:
            #     if u_health > mob.health:
            #         u_health = 1
            #         mob.health = 0
            #     else:
            #         u_health = 0
            #         mob.health = 1

            embed.add_field(  # user health bar
                name=f'**{u.display_name}**',
                value=make_health_bar(
                    (u_health if u_health >= 0 else 0),
                    20,
                    self.d.emojis.heart_full,
                    self.d.emojis.heart_half,
                    self.d.emojis.heart_empty
                ),
                inline=False
            )

            embed.add_field(  # mob health bar
                name=f'**{mob.nice}**',
                value=make_health_bar(
                    (mob.health if mob.health >= 0 else 0),
                    mob_max_health,
                    self.d.emojis.heart_full,
                    self.d.emojis.heart_half,
                    self.d.emojis.heart_empty
                ),
                inline=False
            )

            await ctx.send(embed=embed)

            await self.db.update_user(u.id, 'health', u_health)

            u_db = await self.db.fetch_user(u.id)
            u_bal = u_db['emeralds']

            if u_health > 0:  # user win
                if mob_key != 'baby_slime' or random.randint(0, 25) != 1:
                    if diff == 'easy':  # copied this ~~meth~~ math from the old code idek what it does lmao
                        ems_won = int(u_bal * (1 / random.choice((3, 3.25, 3.5, 3.75, 4)))) if u_bal < 256 else int(
                            512 * (1 / random.choice((3, 3.25, 3.5, 3.75, 4))))
                    else:  # diff hard
                        ems_won = int(u_bal * (1 / random.choice((1.75, 2, 2.25, 2.5)))) if u_bal < 256 else int(
                            512 * (1 / random.choice((1.75, 2, 2.25, 2.5))))

                    ems_won = int((ems_won if ems_won > 0 else 1) * diff_multi)

                    if await self.db.fetch_item(u.id, 'Looting II Book') is not None:
                        ems_won = int(ems_won * 1.75)
                    elif await self.db.fetch_item(u.id, 'Looting I Book') is not None:
                        ems_won = int(ems_won * 1.25)

                    await self.db.balance_add(u.id, ems_won)
                    await self.db.update_lb(u.id, 'mobs_killed', 1, 'add')

                    await self.bot.send(ctx, random.choice(ctx.l.mobs_mech.found).format(ems_won, self.d.emojis.emerald))
                else:
                    if diff == 'easy':
                        balls_won = random.randint(1, 10)
                    else:
                        balls_won = random.randint(1, 20)

                    await self.db.add_item(u.id, 'Slime Ball', 5, balls_won, True)

                    await self.bot.send(ctx, random.choice(ctx.l.mobs_mech.found).format(balls_won, self.d.emojis.slimeball))
            else:  # mob win
                if diff == 'easy':  # haha code copying go brrrrrrrrr
                    ems_lost = int(u_bal * (1 / (random.choice([3.05, 3.3, 3.55, 3.8])+.3))) if u_bal > 20 else random.randint(2, 4)
                else:  # diff hard
                    ems_lost = int(u_bal * (1 / (random.choice([1.45, 1.55, 1.65, 1.75])+.3))) if u_bal > 20 else random.randint(5, 9)

                ems_lost = await self.db.balance_sub(u.id, ems_lost)

                if mob_key == 'creeper':
                    await self.bot.send(ctx, random.choice(ctx.l.mobs_mech.lost.creeper).format(ems_lost, self.d.emojis.emerald))
                else:
                    await self.bot.send(ctx, random.choice(ctx.l.mobs_mech.lost.normal).format(mob.nice.lower(), ems_lost, self.d.emojis.emerald))
        except Exception as e:
            await self.events.debug_error(ctx, e)
コード例 #13
0
ファイル: minecraft.py プロジェクト: quaackk/Villager-Bot
    async def minecraft_profile(self, ctx, player):
        if 17 > len(player) > 1 and player.lower().strip("abcdefghijklmnopqrstuvwxyz1234567890_") == "":
            async with ctx.typing():
                res = await self.aiohttp.get(f"https://api.mojang.com/users/profiles/minecraft/{player}")

            if res.status == 204:
                await self.bot.reply_embed(ctx, ctx.l.minecraft.invalid_player)
                return

            if res.status != 200:
                await self.bot.reply_embed(ctx, ctx.l.minecraft.profile.error)
                return

            jj = await res.json()
            uuid = jj["id"]
        elif (
            len(player) in (32, 36) and player.lower().strip("abcdefghijklmnopqrstuvwxyz1234567890-") == ""
        ):  # player is a uuid
            uuid = player.replace("-", "")
        else:
            await self.bot.reply_embed(ctx, ctx.l.minecraft.invalid_player)
            return

        async with ctx.typing():
            resps = await asyncio.gather(
                self.aiohttp.get(f"https://api.mojang.com/user/profiles/{uuid}/names"),
                self.aiohttp.get(f"https://sessionserver.mojang.com/session/minecraft/profile/{uuid}"),
            )

        for res in resps:
            if res.status == 204:
                await self.bot.reply_embed(ctx, ctx.l.minecraft.invalid_player)
                return

            if res.status != 200:
                await self.bot.reply_embed(ctx, ctx.l.minecraft.profile.error)
                return

        names = cj.classify(await resps[0].json())
        profile = cj.classify(await resps[1].json())

        skin_url = None
        cape_url = None

        for prop in profile["properties"]:
            if prop["name"] == "textures":
                textures = json.loads(base64.b64decode(prop["value"]))["textures"]
                skin_url = textures.get("SKIN", {}).get("url")
                cape_url = textures.get("CAPE", {}).get("url")

                break

        name_hist = "\uFEFF"

        for i, name in enumerate(list(reversed(names))[:20]):
            time = name.get("changedToAt")

            if time is None:
                time = ctx.l.minecraft.profile.first
            else:
                time = arrow.Arrow.fromtimestamp(time)
                time = time.format("MMM D, YYYY", locale=ctx.l.lang) + ", " + time.humanize(locale=ctx.l.lang)

            name_hist += f"**{len(names)-i}.** `{name.name}` - {time}\n"

        embed = discord.Embed(color=self.d.cc, title=ctx.l.minecraft.profile.mcpp.format(profile.name))

        if skin_url is not None:
            embed.description = f"**[{ctx.l.minecraft.profile.skin}]({skin_url})**"

        if cape_url is not None:
            embed.description += f" | **[{ctx.l.minecraft.profile.cape}]({cape_url})**"
        else:
            embed.description += f" | {ctx.l.minecraft.profile.nocape}"

        embed.set_thumbnail(url=f"https://crafatar.com/avatars/{uuid}.png")

        embed.add_field(
            name=":link: UUID",
            value=f"`{uuid[:8]}-{uuid[8:12]}-{uuid[12:16]}-{uuid[16:20]}-{uuid[20:]}`\n`{uuid}`",
            inline=False,
        )
        embed.add_field(name=(":label: " + ctx.l.minecraft.profile.hist), value=name_hist, inline=False)

        await ctx.reply(embed=embed, mention_author=False)
コード例 #14
0
    async def _spawn_event(self, ctx):
        if ctx.guild is None:  # ignore dms
            return

        db_guild = await self.db.fetch_guild(ctx.guild.id)
        difficulty = db_guild["difficulty"]

        if difficulty == "peaceful":
            return

        difficulty_multi = 1.5 if difficulty == "hard" else 1

        # type of mob to be spawned
        mob_key = random.choice(tuple(self.d.mobs_mech.mobs))
        mob = cj.classify({
            **self.d.mobs_mech.mobs[mob_key].copy(),
            **ctx.l.mobs_mech.mobs[mob_key]
        })
        mob_max_health = mob.health

        await asyncio.sleep(random.random() * 3)

        # engage embed
        embed = discord.Embed(
            color=self.d.cc,
            title=
            f"**{random.choice(ctx.l.mobs_mech.mob_drops).format(mob.nice.lower())}**",
            description=ctx.l.mobs_mech.type_engage,
        )
        embed.set_image(url=mob.image)

        engage_msg = await ctx.send(embed=embed)

        # get the user who is going to be attacking the mob
        while True:
            try:
                initial_attack_msg = await self.bot.wait_for(
                    "message", check=self.engage_check(ctx), timeout=15)
            except asyncio.TimeoutError:
                await engage_msg.edit(suppress=True)
                return

            if (await self.ipc.eval(f"econ_paused_users.get({ctx.author.id})")
                ).result is not None:
                continue

            user = initial_attack_msg.author
            db_user = await self.db.fetch_user(user.id)
            user_health = db_user["health"]

            if user_health < 1:
                await self.bot.send_embed(ctx, ctx.l.mobs_mech.no_health)
                continue

            break

        # fetch user's sword, slime trophy, and suppress the engage message
        user_sword, slime_trophy, _ = await asyncio.gather(
            self.db.fetch_sword(user.id),
            self.db.fetch_item(user.id, "Slime Trophy"),
            engage_msg.edit(suppress=True),
        )

        await self.ipc.exec(
            f"econ_paused_users[{ctx.author.id}] = {time.time()}")

        try:
            for iteration in itertools.count(start=1):

                # create embed with mob image
                embed = discord.Embed(color=self.d.cc,
                                      title=ctx.l.mobs_mech.attack_or_flee)
                embed.set_image(url=mob.image)

                # add user health bar to embed
                embed.add_field(
                    name=f"**{user.display_name}**",
                    value=make_health_bar(user_health, 20,
                                          self.d.emojis.heart_full,
                                          self.d.emojis.heart_half,
                                          self.d.emojis.heart_empty),
                    inline=False,
                )

                # add mob health bar to embed
                embed.add_field(
                    name=f"**{mob.nice}**",
                    value=make_health_bar(
                        mob.health,
                        mob_max_health,
                        self.d.emojis.heart_full,
                        self.d.emojis.heart_half,
                        self.d.emojis.heart_empty,
                    ),
                    inline=False,
                )

                fight_msg = await ctx.send(embed=embed)

                try:
                    user_action_msg = await self.bot.wait_for(
                        "message",
                        check=self.attack_check(ctx, initial_attack_msg),
                        timeout=30)
                    user_action = user_action_msg.content.lower()
                except asyncio.TimeoutError:
                    timed_out = True
                else:
                    timed_out = False

                # check if user is a f*****g baby
                if timed_out or user_action in self.d.mobs_mech.valid_flees:
                    await fight_msg.edit(suppress=True)
                    await self.bot.send_embed(
                        ctx, random.choice(ctx.l.mobs_mech.flee_insults))

                    return

                user_dmg = await self.calculate_sword_damage(
                    user.id, user_sword, difficulty_multi)

                # bebe slime is godlike
                if mob_key == "baby_slime":
                    if iteration < 3 and slime_trophy is None:
                        user_dmg = 0
                    elif slime_trophy is not None and random.choice(
                        (True, False, False)):
                        user_dmg = 0
                    elif iteration >= 3 and random.choice((True, False)):
                        user_dmg = 0

                mob.health -= user_dmg

                if mob.health < 1:  # user wins
                    await fight_msg.edit(suppress=True)
                    await self.bot.send_embed(
                        ctx,
                        random.choice(ctx.l.mobs_mech.user_finishers).format(
                            mob.nice.lower(), user_sword.lower()))

                    break
                else:
                    if mob_key == "baby_slime" and user_dmg == 0:  # say user missed the slime
                        await self.bot.send_embed(
                            ctx,
                            random.choice(mob.misses).format(
                                user_sword.lower()))
                    else:  # send regular attack message
                        await self.bot.send_embed(
                            ctx,
                            random.choice(ctx.l.mobs_mech.user_attacks).format(
                                mob.nice.lower(), user_sword.lower()))

                async with ctx.typing():
                    await asyncio.sleep(0.75 + random.random() * 2)

                mob_dmg = random.randint(2, 6)

                if mob_key == "creeper":  # add creeper mechanics
                    if iteration > 2:
                        if random.choice(
                            (True, True, False)
                        ):  # creeper yeets your bloodied corpse across the map
                            user_health = 0

                            await fight_msg.edit(suppress=True)
                            await self.bot.send_embed(
                                ctx, random.choice(mob.finishers))

                            break

                    mob_dmg = 0

                user_health -= mob_dmg
                user_health = max(user_health, 0)

                if user_health < 1:  # you == noob
                    await self.bot.send_embed(ctx,
                                              random.choice(mob.finishers))
                    break
                else:
                    await self.bot.send_embed(ctx, random.choice(mob.attacks))

                async with ctx.typing():
                    await asyncio.sleep(0.75 + random.random() * 2)

                await fight_msg.edit(suppress=True)

            # outside of the for loop
            embed = discord.Embed(color=self.d.cc)
            embed.set_image(url=mob.image)

            embed.add_field(  # user health bar
                name=f"**{user.display_name}**",
                value=make_health_bar(
                    max(user_health, 0),
                    20,
                    self.d.emojis.heart_full,
                    self.d.emojis.heart_half,
                    self.d.emojis.heart_empty,
                ),
                inline=False,
            )

            embed.add_field(  # mob health bar
                name=f"**{mob.nice}**",
                value=make_health_bar(
                    max(mob.health, 0),
                    mob_max_health,
                    self.d.emojis.heart_full,
                    self.d.emojis.heart_half,
                    self.d.emojis.heart_empty,
                ),
                inline=False,
            )

            await ctx.send(embed=embed)

            db_user = await self.db.fetch_user(user.id)
            user_bal = db_user["emeralds"]

            if user_health > 0:  # user win
                if mob_key != "baby_slime" or random.randint(0, 25) != 1:
                    if difficulty == "easy":  # copied this ~~meth~~ math from the old code idek what it does lmao
                        ems_won = (int(user_bal * (1 / random.choice(
                            (3, 3.25, 3.5, 3.75, 4)))) if user_bal < 256 else
                                   int(512 * (1 / random.choice(
                                       (3, 3.25, 3.5, 3.75, 4)))))
                    else:  # difficulty hard
                        ems_won = (int(user_bal * (1 / random.choice(
                            (1.75, 2, 2.25, 2.5)))) if user_bal < 256 else int(
                                512 * (1 / random.choice(
                                    (1.75, 2, 2.25, 2.5)))))

                    ems_won = int(
                        (ems_won if ems_won > 0 else 1) * difficulty_multi)

                    if await self.db.fetch_item(user.id,
                                                "Looting II Book") is not None:
                        ems_won = int(ems_won * 1.75)
                    elif await self.db.fetch_item(
                            user.id, "Looting I Book") is not None:
                        ems_won = int(ems_won * 1.25)

                    await self.db.balance_add(user.id, ems_won)
                    await self.db.update_lb(user.id, "mobs_killed", 1, "add")

                    await self.bot.send_embed(
                        ctx,
                        random.choice(ctx.l.mobs_mech.found).format(
                            ems_won, self.d.emojis.emerald))
                else:
                    if difficulty == "easy":
                        balls_won = random.randint(1, 10)
                    else:
                        balls_won = random.randint(1, 20)

                    if await self.db.fetch_item(user.id,
                                                "Looting II Book") is not None:
                        balls_won *= 1.5
                    elif await self.db.fetch_item(
                            user.id, "Looting I Book") is not None:
                        balls_won *= 1.25

                    balls_won = round(balls_won)

                    await self.db.add_item(user.id, "Slime Ball", 5, balls_won,
                                           True)

                    await self.bot.send_embed(
                        ctx,
                        random.choice(ctx.l.mobs_mech.found).format(
                            balls_won, self.d.emojis.slimeball))
            else:  # mob win
                if difficulty == "easy":  # haha code copying go brrrrrrrrr
                    ems_lost = (int(
                        user_bal *
                        (1 / (random.choice([3.05, 3.3, 3.55, 3.8]) + 0.3)))
                                if user_bal > 20 else random.randint(2, 4))
                else:  # difficulty hard
                    ems_lost = (int(
                        user_bal *
                        (1 / (random.choice([1.45, 1.55, 1.65, 1.75]) + 0.3)))
                                if user_bal > 20 else random.randint(5, 9))

                ems_lost = await self.db.balance_sub(user.id, ems_lost)

                if mob_key == "creeper":
                    await self.bot.send_embed(
                        ctx,
                        random.choice(ctx.l.mobs_mech.lost.creeper).format(
                            ems_lost, self.d.emojis.emerald))
                else:
                    await self.bot.send_embed(
                        ctx,
                        random.choice(ctx.l.mobs_mech.lost.normal).format(
                            mob.nice.lower(), ems_lost, self.d.emojis.emerald),
                    )
        finally:
            await self.db.update_user(user.id, health=user_health)
            await self.ipc.eval(f"econ_paused_users.pop({ctx.author.id}, None)"
                                )  # unpause user