async def check_level(user_id): if(User.get_xp(user_id) < User.get_max_xp(user_id)): return if(User.get_level(user_id) < Level.get_max_level_number()): while(User.get_xp(user_id) > User.get_max_xp(user_id)): if(User.get_level(user_id) < Level.get_max_level_number()): await levelup_notification(user_id) await edit_user_role(user_id) User.increment_level(user_id) level_number = User.get_level(user_id) level_max_xp = Level.get_max_xp(level_number) User.set_max_xp(user_id, level_max_xp) elif(User.get_level(user_id) == Level.get_max_level_number()): await levelup_notification(user_id) await edit_user_role(user_id) break elif(User.get_xp(user_id) == User.get_max_xp(user_id)): await levelup_notification(user_id) await edit_user_role(user_id)
def get_max_level_number(): return Level.get_max_level_number()