def add_to_list(tornament_name, uid): num = databasemanager.add_to_list(tornament_name, uid) databasemanager.add_to_list('tor_names', tornament_name) if num < -1: return False return True
def start_tornament(tornament_name, reply): uids = databasemanager.get_list(tornament_name) databasemanager.clear_list(tornament_name) tornament_id = str(round(time.time() * 1000)) tornament_dict = get_tornament_dict(tornament_id, uids) save_tornament(tornament_id, uids) databasemanager.add_to_list('tors', tornament_id) for uid in uids: def rep(txt, btns=None, photo=None): reply(uid, txt, btns, photo) usr = usermanager.get_user(uid) if usr: usr.start_tornament(tornament_id, rep) usermanager.save_user(usr)