def db_set(user_id,column,value): """Alter a specific bit of information of a given player Keyword argumentsL user_id -> the user's id column -> the relevant part of info value -> the new value it should be set to """ positionof(column) # Make sure the value is valid. c.execute("UPDATE game SET {}=? WHERE id=?".format(column), (value,user_id)) conn.commit()
def db_get(user_id, column): """Gain a specific bit of information from a given player Keyword arguments: user_id -> the user's id column -> the relevant part of info """ values = get_user(user_id) if values == None: return None return values[positionof(column)]
def test_positionof(): assert positionof("frozen") == 13 assert positionof("fakerole") == 6 assert positionof("votes") == 8 assert positionof("sleepers") == 19 assert positionof("bitten") == 16 assert positionof("id") == 0
def db_get(user_id, column): return get_user(user_id)[positionof(column)]