Ejemplo n.º 1
0
async def get_fah_stats():
    team = fah.Team(235150)
    highest_scorer = team.highest_scorer
    most_wus = team.most_wus
    score = team.score
    work_units = team.work_units
    highest_scorer["credit"] = format.convert_int(highest_scorer["credit"])
    most_wus["wus"] = format.convert_int(most_wus["wus"])
    return highest_scorer, most_wus, score, work_units
Ejemplo n.º 2
0
async def stats(ctx, donor=None):
    if donor:
        try:
            donor = fah.Donor(donor, team_number)
        except:
            await ctx.channel.send(
                "Something went wrong. You may have entered an invalid donor or there may be a problem reaching Folding@Home, please try again.\nIf this has happened before, please try again later."
            )

        title = "Folding@Home statistics for '{}'".format(donor.name)
        description = "Donor '{}'".format(donor.name)
        embed = discord.Embed(title=title, description=description, color=embedcolor)
        embed.add_field(name="Total credits for team", value=donor.score, inline=False)
        embed.add_field(
            name="Total work units completed for team",
            value=donor.work_units,
            inline=False,
        )
        embed.add_field(name="Rank", value=donor.rank, inline=False)
        embed.set_thumbnail(url=donor.team["logo"])
        await ctx.channel.send(embed=embed)
    else:
        team = fah.Team(team_number)
        description = "Team {}".format(team.name)
        rank = "Rank out of {}".format(team.total_teams)
        embed = discord.Embed(
            title="Folding@Home statistics", description=description, color=embedcolor
        )
        embed.add_field(name="Total credits", value=str(team.score), inline=False)
        embed.add_field(
            name="Total work units", value=str(team.work_units), inline=False
        )
        embed.add_field(name=rank, value=str(team.rank), inline=False)
        if team.total_donors == 1000:
            embed.add_field(name="Total number of donors", value="1000+", inline=False)
        else:
            embed.add_field(
                name="Total number of donors",
                value=str(team.total_donors),
                inline=False,
            )
        embed.set_thumbnail(url=team.logo)
        await ctx.channel.send(embed=embed)
Ejemplo n.º 3
0
async def team(ctx, team=team_number):
    team = fah.Team(team)
    description = f"Team {team.name}"
    rank = f"Rank out of {team.total_teams}"
    embed = discord.Embed(
        title="Folding@Home statistics", description=description, color=embedcolor
    )
    embed.add_field(name="Total credits", value=str(team.score), inline=False)
    embed.add_field(name="Total work units", value=str(team.work_units), inline=False)
    embed.add_field(name=rank, value=str(team.rank), inline=False)
    if team.total_donors == 1000:
        embed.add_field(name="Total number of donors", value="1000+", inline=False)
    else:
        embed.add_field(
            name="Total number of donors", value=str(team.total_donors), inline=False
        )
    print(team.logo)
    embed.set_thumbnail(url=team.logo)
    await ctx.channel.send(embed=embed)
async def team(ctx, team=team_number):
    stats = fah.Team(team).stats()
    description = 'Team {}'.format(stats["name"])
    rank = "Rank out of {}".format(stats["total_teams"])
    embed = discord.Embed(title="Folding@Home statistics",
                          description=description,
                          color=embedcolor)
    embed.add_field(name="Total credits",
                    value=str(stats["credit"]),
                    inline=False)
    embed.add_field(name="Total work units",
                    value=str(stats["wus"]),
                    inline=False)
    embed.add_field(name=rank, value=str(stats["rank"]), inline=False)
    embed.add_field(name="Total number of donors",
                    value=str(len(stats["donors"])),
                    inline=False)
    embed.set_thumbnail(url=stats["logo"])
    await ctx.message.channel.send(embed=embed)