Fixed third user warning
This commit is contained in:
parent
df9c889c7e
commit
b0990b626c
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user