コード例 #1
0
ファイル: setbase.py プロジェクト: GigaTimeMia/SizeBot
    async def setbaseshoe(self, ctx, *, newshoe: str):
        """Set a custom base shoe size.

        Accepts a US Shoe Size.
        If a W is in the shoe size anywhere, it is parsed as a Women's size.
        If a C is in the show size anywhere, it is parsed as a Children's size."""

        userdata = userdb.load(ctx.guild.id, ctx.author.id, allow_unreg=True)

        newfoot = fromShoeSize(newshoe)

        userdata.footlength = newfoot
        userdb.save(userdata)

        await ctx.send(
            f"{userdata.nickname}'s foot is now {userdata.footlength:mu} long. ({formatShoeSize(userdata.footlength)})"
        )
        await showNextStep(ctx, userdata)
コード例 #2
0
    async def setshoe(self, ctx, *, newshoe):
        """Set your current shoe size.

        Accepts a US Shoe Size.
        If a W is in the shoe size anywhere, it is parsed as a Women's size.
        If a C is in the show size anywhere, it is parsed as a Children's size."""

        userdata = userdb.load(ctx.guild.id, ctx.author.id, allow_unreg=True)

        newfoot = fromShoeSize(newshoe)

        userdata.footlength = SV(newfoot * userdata.viewscale)
        userdb.save(userdata)

        await ctx.send(
            f"{userdata.nickname}'s base foot length is now {userdata.footlength:mu} long ({formatShoeSize(userdata.footlength)}), "
            f"or {(SV(userdata.footlength * userdata.scale)):mu} currently. {formatShoeSize(SV(userdata.footlength * userdata.scale))}"
        )
        await showNextStep(ctx, userdata)
コード例 #3
0
ファイル: set.py プロジェクト: relisys66/SizeBot3AndAHalf
    async def setbaseshoe(self, ctx, *, newshoe: str):
        """Set a custom base shoe size.

        Accepts a US Shoe Size.
        If a W is in the shoe size anywhere, it is parsed as a Women's size.
        If a C is in the show size anywhere, it is parsed as a Children's size."""

        userdata = userdb.load(ctx.guild.id, ctx.author.id)

        newfoot = fromShoeSize(newshoe)

        userdata.footlength = newfoot
        userdb.save(userdata)

        logger.info(
            f"User {ctx.author.id} ({ctx.author.display_name})'s foot is now {userdata.footlength:m} long."
        )
        await ctx.send(
            f"<@{ctx.author.id}>'s foot is now {userdata.footlength:mu} long. ({formatShoeSize(userdata.footlength)})"
        )
コード例 #4
0
def test_reverse_shoesize_calc():
    insize = SV.parse("10in")
    shoesize = formatShoeSize(insize)
    outsize = fromShoeSize(shoesize)
    assert insize == outsize