コード例 #1
0
async def embed_show_char_info(ctx, u, c):
    color = discord.Color.red()
    char_DB = character.get_character(c["name"])
    if char_DB.element == "Anemo":
        color = discord.Color.green()
    elif char_DB.element == "Dendro":
        color = discord.Color.dark_green()
    elif char_DB.element == "Electro":
        color = discord.Color.purple()
    elif char_DB.element == "Hydro":
        color = discord.Color.dark_blue()
    elif char_DB.element == "Geo":
        color = discord.Color.orange()
    elif char_DB.element == "Cryo":
        color = discord.Color.blue()
    const_names_dict = char_DB.constellation_name
    const_names = ""
    for key in const_names_dict.keys():
        if const_names == "":
            const_names += const_names_dict[key]
        else:
            const_names += " or " + const_names_dict[key]
    embed = discord.Embed(title="{un}\'s {cn}".format(un=u.nickname,
                                                      cn=char_DB.name),
                          color=color,
                          description=char_DB.description)
    level = formatter_custom.number_format(c["level"])
    currXP = formatter_custom.number_format(c["xp"])
    maxXP = formatter_custom.number_format(
        formatter_custom.get_xp_to_next_level(c["level"]))
    embed.add_field(name="Level {l}".format(l=level),
                    value="**XP:** {x}/{xm}".format(x=currXP, xm=maxXP))
    embed.add_field(
        name="Amount Info",
        value="**Constellations Unlocked:** {cu}\n**Total Wished:** {tr}".
        format(cu=c["const_amnt"],
               tr=formatter_custom.number_format(c["total"])))
    if len(c["weapon_equiped"]) == 0:
        text = "None"
    else:
        text = c["weapon_equiped"]["name"]
    embed.add_field(name="Equiped Weapon", value=text)
    embed.add_field(
        name="Trivia Info",
        value="**Element:** {e}\n**Constellation:** {c}\n**Weapon Type:** {w}".
        format(e=char_DB.element,
               c=const_names,
               w=formatter_custom.name_unformatter(
                   formatter_custom.name_formatter(char_DB.weapon_type))))
    f = []
    f.append(discord.File(c["URL_icon"], "{}-icon.png".format(c["URL_name"])))
    f.append(
        discord.File(c["URL_portrait"],
                     "{}-portrait.png".format(c["URL_name"])))
    embed.set_image(url="attachment://{}-portrait.png".format(c["URL_name"]))
    embed.set_thumbnail(url="attachment://{}-icon.png".format(c["URL_name"]))

    await ctx.send(embed=embed, files=f)
コード例 #2
0
async def embed_balance(ctx, u):
    embed = discord.Embed(title=f"{u.nickname}\'s Balance",
                          color=discord.Color.dark_orange())
    embed.add_field(name="Primogems",
                    value=formatter_custom.number_format(u.primogems))
    embed.add_field(name="Mora", value=formatter_custom.number_format(u.mora))
    embed.add_field(name="Star Glitter",
                    value=formatter_custom.number_format(u.star_glitter))
    embed.add_field(name="Star Dust",
                    value=formatter_custom.number_format(u.star_dust))
    f = discord.File("Images/Other/Balance.png", "Balance.png")
    embed.set_thumbnail(url="attachment://Balance.png")
    await ctx.send(embed=embed, file=f)
コード例 #3
0
async def embed_show_weap_info(ctx, u, w):
    weap_DB = weapon.get_weapon(w["name"])
    embed = discord.Embed(
        title="{un}\'s {cn}".format(un=u.nickname, cn=weap_DB.name))
    embed.add_field(
        name="Info",
        value=
        "**Level:** {l}\n**XP:** {x}/{xm}\n**Refinement:** {cu}\n**Total Wished:** {tr}"
        .format(l=formatter_custom.number_format(w["level"]),
                cu=w["refinement"],
                tr=formatter_custom.number_format(w["total"]),
                x=formatter_custom.number_format(w["xp"]),
                xm=formatter_custom.number_format(
                    formatter_custom.get_xp_to_next_level(w["level"]))))
    embed.add_field(name="Type", value="{}".format(weap_DB.weapon_type))
    f = discord.File(w["URL_icon"], "{}-icon.png".format(w["URL_name"]))
    embed.set_thumbnail(url="attachment://{}-icon.png".format(w["URL_name"]))

    await ctx.send(embed=embed, file=f)
コード例 #4
0
async def embed_leader_boards(ctx):
    top10_user_dicts = database_mongo.get_leaderboards()
    text = ""
    count = 1
    for u_name in top10_user_dicts.keys():
        text += "**{c}**: **`{n}`** | AR: **`{a}`** | EXP: **`{e}`**\n".format(
            c=count,
            n=top10_user_dicts[u_name]["nickname"],
            a=formatter_custom.number_format(
                top10_user_dicts[u_name]["adventure_rank"]),
            e=formatter_custom.number_format(
                top10_user_dicts[u_name]["experience"]))
        count += 1
    if text == "":
        text = "None"
    embed = discord.Embed(title="Top 10 Yapa-Players",
                          color=discord.Color.blue(),
                          description=text)
    embed.set_footer(
        text="Leader boards update every day at Noon and Midnight-EST")
    await ctx.send(embed=embed)
コード例 #5
0
async def embed_show_shop(ctx, u, _type):
    shop = get_shop(database_mongo.get_shop_dict(u._id))

    primo_text_list = []
    mora_text_list = []
    sg_text_list = []
    sd_text_list = []
    for i in shop.inventory.keys():
        textList = []
        spacer_amnt = 30
        if shop.inventory[i]["amount"] > 0:
            textList.append("({}) ".format(shop.inventory[i]["amount"]))
            spacer_amnt -= len(textList[0])
        x = formatter_custom.number_format(shop.inventory[i]["item"]["count"])
        y = shop.inventory[i]["item"]["name"]
        z = formatter_custom.number_format(shop.inventory[i]["cost"])
        ct = shop.inventory[i]["cost_type"].upper()
        spacer_amnt -= (len(str(x)) + len(str(y)) + len(str(z)) + len(str(ct)))
        textList.append(f"{x}x {y} ")
        if spacer_amnt > 0:
            for x in range(spacer_amnt):
                textList.append("=")
        textList.append(f" {z} {ct}")
        text = "".join(textList)

        if shop.inventory[i]["amount"] == 0:
            textList = [formatter_custom.strike(text), " SOLDOUT"]
            text = "".join(textList)

        if shop.inventory[i]["cost_type"] == "p":
            primo_text_list.append(text + "\n")
        if shop.inventory[i]["cost_type"] == "m":
            mora_text_list.append(text + "\n")
        if shop.inventory[i]["cost_type"] == "sd":
            sd_text_list.append(text + "\n")
        if shop.inventory[i]["cost_type"] == "sg":
            sg_text_list.append(text + "\n")

    primo_text = "None"
    mora_text = "None"
    sd_text = "None"
    sg_text = "None"

    if len(primo_text_list) > 0:
        primo_text = "".join(["```", "".join(primo_text_list), "```"])
    if len(mora_text_list) > 0:
        mora_text = "".join(["```", "".join(mora_text_list), "```"])
    if len(sd_text_list) > 0:
        sd_text = "".join(["```", "".join(sd_text_list), "```"])
    if len(sg_text_list) > 0:
        sg_text = "".join(["```", "".join(sg_text_list), "```"])

    embed = discord.Embed(title=f"{u.nickname}'s Shop",
                          color=discord.Color.dark_green())
    if _type == "all":
        embed.add_field(name="Primogems Shop", value=primo_text, inline=False)
        embed.add_field(name="Mora Shop", value=mora_text, inline=False)
        embed.add_field(name="Stardust Shop", value=sd_text, inline=False)
        embed.add_field(name="Starglitter Shop", value=sg_text, inline=False)
    elif _type == "p":
        embed.add_field(name="Primogems Shop", value=primo_text, inline=False)
    elif _type == "m":
        embed.add_field(name="Mora Shop", value=mora_text, inline=False)
    elif _type == "sd":
        embed.add_field(name="Stardust Shop", value=sd_text, inline=False)
    elif _type == "sg":
        embed.add_field(name="Starglitter Shop", value=sg_text, inline=False)
    embed.set_footer(text="Shop resets at 00:00 Monday EST")
    await ctx.send(embed=embed)
コード例 #6
0
ファイル: pull.py プロジェクト: hoj2atwit/Yapa-Bot-PY
async def embed_jackpot(ctx):
  embed = discord.Embed(title="Current Jackpots", color=discord.Color.dark_gold())
  embed.add_field(name="Mora Jackpot", value=formatter_custom.number_format(database_mongo.get_jackpot_mora()))
  embed.add_field(name="Primo Jackpot", value=formatter_custom.number_format(database_mongo.get_jackpot_primo()))
  await ctx.send(embed=embed)