예제 #1
0
def add_to_stats(member, game_name, wins=0, played=0):
    userdata = getuser(member.id)
    stats = userdata.get("stats", {})
    stats[game_name] = [
        x + y for x, y in zip(stats.get(game_name, [0, 0]), [wins, played])
    ]
    userdata["stats"] = stats
    setuser(member.id, userdata)
예제 #2
0
def withdraw_money(member, amount):
    userdata = getuser(member.id)
    oldmoney = userdata.get("money", 0)
    if oldmoney >= amount:
        userdata["money"] = oldmoney - amount
        setuser(member.id, userdata)
        return True
    else:
        return False
예제 #3
0
def set_money(member, amount):
    userdata = getuser(member.id)
    userdata["money"] = amount
    setuser(member.id, userdata)
    return
예제 #4
0
async def add_xp(member, xp):
    userdata = getuser(member.id)
    oldxp = userdata.get("xp", 0)
    userdata["xp"] = oldxp + xp
    setuser(member.id, userdata)
    await update_player_nick(member)
예제 #5
0
def deposit_money(member, amount):
    userdata = getuser(member.id)
    oldmoney = userdata.get("money", 0)
    userdata["money"] = oldmoney + amount
    setuser(member.id, userdata)
    return