Beispiel #1
0
async def empty(ctx, division, minutes: int = 0):
    _process_member(ctx.message.author)
    if not (ctx.channel.id == 603527159109124096
            or DB.get_member(ctx.message.author.id).get("pm_is_allowed")):
        return await ctx.send("Currently unavailable!")
    try:
        div = int(division)
    except ValueError:
        try:
            div = dict(D1=1, D2=3, D3=3, D4=4, Air=11)[division.title()]
        except (AttributeError, KeyError):
            return await ctx.send(
                "First argument must be a value from: 1, d1, 2, d2, 3, d3, 4, d4, 11, air!"
            )
    s_div = {1: "D1", 2: "D2", 3: "D3", 4: "D4", 11: "Air"}[div]
    embed = Embed(
        title=f"Possibly empty {s_div} medals",
        description=
        "'Empty' medals are being guessed based on the division wall. Expect false-positives!",
    )
    for kind, div_div, data in check_battles(get_battle_page().get("battles")):
        if kind == "empty" and div_div == div and data[
                "round_time_s"] >= minutes * 60:
            embed.add_field(
                name=
                f"**Battle for {data['region']} {' '.join(data['sides'])}**",
                value=
                f"[R{data['zone_id']} | Time {data['round_time']}]({data['url']})",
            )
            if len(embed.fields) >= 10:
                return await ctx.send(embed=embed)
    if embed.fields:
        return await ctx.send(embed=embed)
    else:
        return await ctx.send(f"No empty {s_div} medals found")
Beispiel #2
0
def _process_member(member):
    if not DB.get_member(member.id):
        DB.add_member(member.id, str(member))