From b0990b626c215ec664b97ec94988a2867cb2b22e Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 26 Jan 2024 11:36:42 +0100 Subject: [PATCH] Fixed third user warning --- bot/src/modules/base/service/user_warnings_service.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bot/src/modules/base/service/user_warnings_service.py b/bot/src/modules/base/service/user_warnings_service.py index 125b82a2..7eaa8141 100644 --- a/bot/src/modules/base/service/user_warnings_service.py +++ b/bot/src/modules/base/service/user_warnings_service.py @@ -92,13 +92,10 @@ class UserWarningsService: elif existing_warnings.count() == 3: server = self._servers.get_server_by_discord_id(member.guild.id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id) - levels = self._levels.get_levels_by_server_id(server.id) - new_level = levels.where(lambda l: l.min_xp > 0).order_by(lambda l: l.min_xp).last_or_default() - if new_level is not None: - user.xp = new_level.min_xp - self._users.update_user(user) - self._db.save_changes() + user.xp = 0 + self._users.update_user(user) + self._db.save_changes() await self.notify_user(member, self._t.transform("modules.base.warnings.third")) elif existing_warnings.count() >= 4: