diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index 206df3ea17..447b232e4c 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -149,6 +149,9 @@ "boot_log": { "login_message": "Ich bin on the line :D\nDer Scheiß hat {} Sekunden gedauert" }, + "level": { + "new_level_message": "<@{}> ist nun Level {}" + }, "database": {}, "permission": { } diff --git a/kdb-bot/src/modules/level/service/level_service.py b/kdb-bot/src/modules/level/service/level_service.py index 6385b9ae67..bf53b11ce8 100644 --- a/kdb-bot/src/modules/level/service/level_service.py +++ b/kdb-bot/src/modules/level/service/level_service.py @@ -6,6 +6,7 @@ from cpl_core.database.context import DatabaseContextABC from cpl_core.logging import LoggerABC from cpl_discord.container import Guild, Role, Member from cpl_discord.service import DiscordBotServiceABC +from cpl_translation import TranslatePipe from bot_core.service.message_service import MessageService from bot_data.model.level import Level @@ -27,7 +28,8 @@ class LevelService: users: UserRepositoryService, servers: ServerRepositoryService, bot: DiscordBotServiceABC, - message_service: MessageService + message_service: MessageService, + t: TranslatePipe ): self._config = config self._logger = logger @@ -37,6 +39,7 @@ class LevelService: self._servers = servers self._bot = bot self._message_service = message_service + self._t = t def get_level(self, user: User) -> Level: levels = self._levels.get_levels_by_server_id(user.server.server_id).order_by(lambda l: l.min_xp) @@ -73,7 +76,7 @@ class LevelService: level_settings: LevelServerSettings = self._config.get_configuration(f'LevelServerSettings_{guild.id}') await self._message_service.send_channel_message( self._bot.get_channel(level_settings.changed_level_notification_channel), - f'<@{member.id}> ist nun Level {level.name}', + self._t.transform('modules.level.new_level_message'.format(member.id, level.name)), is_persistent=True )