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)
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
def set_money(member, amount): userdata = getuser(member.id) userdata["money"] = amount setuser(member.id, userdata) return
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)
def deposit_money(member, amount): userdata = getuser(member.id) oldmoney = userdata.get("money", 0) userdata["money"] = oldmoney + amount setuser(member.id, userdata) return