Check level in sync command
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 4m35s
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 4m35s
This commit is contained in:
parent
189b6370a9
commit
ef0fab1178
@ -19,6 +19,7 @@ from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from bot_data.model.server_config import ServerConfig
|
||||
from bot_data.model.technician_config import TechnicianConfig
|
||||
from bot_data.model.user import User
|
||||
from modules.level.service.level_service import LevelService
|
||||
from modules.permission.abc.permission_service_abc import PermissionServiceABC
|
||||
|
||||
|
||||
@ -36,6 +37,7 @@ class SyncXpGroup(DiscordCommandABC):
|
||||
permissions: PermissionServiceABC,
|
||||
settings: TechnicianConfig,
|
||||
db: DatabaseContextABC,
|
||||
level_service: LevelService,
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
|
||||
@ -50,6 +52,7 @@ class SyncXpGroup(DiscordCommandABC):
|
||||
self._permissions = permissions
|
||||
self._settings = settings
|
||||
self._db = db
|
||||
self._level_service = level_service
|
||||
|
||||
self._logger.trace(__name__, f"Loaded command service: {type(self).__name__}")
|
||||
|
||||
@ -93,6 +96,7 @@ class SyncXpGroup(DiscordCommandABC):
|
||||
user.xp = user_on_other_server.xp
|
||||
self._users.update_user(user)
|
||||
self._db.save_changes()
|
||||
await self._level_service.check_level(ctx.guild.get_member(user.discord_id))
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f"Cannot sync user {user.name}", e)
|
||||
|
||||
@ -144,6 +148,7 @@ class SyncXpGroup(DiscordCommandABC):
|
||||
self._logger.error(__name__, f"Cannot sync user {user.name}", e)
|
||||
|
||||
await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.technician.synced_message"))
|
||||
await self._level_service.check_level(member)
|
||||
self._logger.trace(__name__, f"Finished sync xp command")
|
||||
|
||||
@by_member.autocomplete("server_id")
|
||||
|
Loading…
Reference in New Issue
Block a user