Reviewed-on: sh-edraft.de/kd_discord_bot#282 Reviewed-by: Ebola-Chan <nick.jungmann@gmail.com> Closes #281
This commit is contained in:
commit
1777a32899
@ -1,3 +1,5 @@
|
||||
import time
|
||||
|
||||
from cpl_core.database import DatabaseSettings
|
||||
from cpl_core.database.context import DatabaseContext
|
||||
|
||||
@ -31,4 +33,9 @@ class DBContext(DatabaseContext):
|
||||
return super(DBContext, self).select(statement)
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f"Database error caused by {statement}", e)
|
||||
try:
|
||||
time.sleep(0.5)
|
||||
return self.select(statement)
|
||||
except Exception as e:
|
||||
pass
|
||||
return []
|
||||
|
@ -39,6 +39,7 @@ class UserMutation(QueryABC):
|
||||
|
||||
if "levelId" in input:
|
||||
level = self._levels.get_level_by_id(input["levelId"])
|
||||
if user.level.id != level.id:
|
||||
user.xp = level.min_xp
|
||||
else:
|
||||
user.xp = input["xp"] if "xp" in input else user.xp
|
||||
|
Loading…
Reference in New Issue
Block a user