From 85852bf2f0391d197c06f6e8cb40674c0a81bd5e Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 10 Sep 2023 11:07:37 +0200 Subject: [PATCH] Added check with -xp to get_level --- kdb-bot/src/modules/level/service/level_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kdb-bot/src/modules/level/service/level_service.py b/kdb-bot/src/modules/level/service/level_service.py index 3dccade3..c7de2b75 100644 --- a/kdb-bot/src/modules/level/service/level_service.py +++ b/kdb-bot/src/modules/level/service/level_service.py @@ -40,6 +40,9 @@ class LevelService: def get_level(self, user: User) -> Level: levels_by_server = self._levels.get_levels_by_server_id(user.server.id) + if user.xp < 0: + levels_by_server.first() + levels = levels_by_server.order_by(lambda l: l.min_xp).where(lambda l: user.xp >= l.min_xp) if levels.count() == 0: