From 24d5bbf4d8d39fb184647d9ef1ab83c38a9912f3 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 24 Mar 2023 14:14:49 +0100 Subject: [PATCH] Made version in presence optional --- kdb-bot/src/bot/translation/de.json | 8 ++++---- kdb-bot/src/bot_core/configuration/feature_flags_enum.py | 5 +++-- .../src/bot_core/configuration/feature_flags_settings.py | 2 +- kdb-bot/src/bot_core/service/client_utils_service.py | 6 +++++- kdb-web/src/app/services/auth/auth.service.ts | 1 - 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index 4089a9b8..4b6654d9 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -86,10 +86,10 @@ "no_permission_message": "Nein!\nIch höre nicht auf dich ¯\\_(ツ)_/¯", "not_implemented_yet": "Ey Alter, das kann ich noch nicht...", "presence": { - "booting": "{} Ich fahre gerade hoch...", - "restart": "{} Muss neue Kekse holen...", - "running": "{} Ich esse Kekse :D", - "shutdown": "{} Ich werde bestimmt wieder kommen..." + "booting": "Ich fahre gerade hoch...", + "restart": "Muss neue Kekse holen...", + "running": "Ich esse Kekse :D", + "shutdown": "Ich werde bestimmt wieder kommen..." } }, "modules": { diff --git a/kdb-bot/src/bot_core/configuration/feature_flags_enum.py b/kdb-bot/src/bot_core/configuration/feature_flags_enum.py index 50945c4e..aeb18a99 100644 --- a/kdb-bot/src/bot_core/configuration/feature_flags_enum.py +++ b/kdb-bot/src/bot_core/configuration/feature_flags_enum.py @@ -10,11 +10,12 @@ class FeatureFlagsEnum(Enum): boot_log_module = "BootLogModule" core_module = "CoreModule" core_extension_module = "CoreExtensionModule" - data_module = ("DataModule",) - database_module = ("DatabaseModule",) + data_module = "DataModule" + database_module = "DatabaseModule" level_module = "LevelModule" moderator_module = "ModeratorModule" permission_module = "PermissionModule" # features api_only = "ApiOnly" presence = "Presence" + version_in_presence = "VersionInPresence" diff --git a/kdb-bot/src/bot_core/configuration/feature_flags_settings.py b/kdb-bot/src/bot_core/configuration/feature_flags_settings.py index 0b34969c..777e256b 100644 --- a/kdb-bot/src/bot_core/configuration/feature_flags_settings.py +++ b/kdb-bot/src/bot_core/configuration/feature_flags_settings.py @@ -1,5 +1,4 @@ import traceback -from typing import Optional, Callable from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC from cpl_core.console import Console @@ -27,6 +26,7 @@ class FeatureFlagsSettings(ConfigurationModelABC): # features FeatureFlagsEnum.api_only.value: False, # 13.10.2022 #70 FeatureFlagsEnum.presence.value: True, # 03.10.2022 #56 + FeatureFlagsEnum.version_in_presence.value: False, # 21.03.2023 #253 } def get_flag(self, key: FeatureFlagsEnum) -> bool: diff --git a/kdb-bot/src/bot_core/service/client_utils_service.py b/kdb-bot/src/bot_core/service/client_utils_service.py index b0cd36b3..deab648d 100644 --- a/kdb-bot/src/bot_core/service/client_utils_service.py +++ b/kdb-bot/src/bot_core/service/client_utils_service.py @@ -111,7 +111,11 @@ class ClientUtilsService(ClientUtilsABC): import bot - name = self._t.transform(t_key).format(bot.__version__) + if self._feature_flags.get_flag(FeatureFlagsEnum.version_in_presence): + name = f"{bot.__version__} {self._t.transform(t_key)}" + else: + name = self._t.transform(t_key) + await self._bot.change_presence(activity=discord.Game(name=name)) self._logger.info(__name__, f"Set presence {name}") diff --git a/kdb-web/src/app/services/auth/auth.service.ts b/kdb-web/src/app/services/auth/auth.service.ts index db50dbf4..f51db323 100644 --- a/kdb-web/src/app/services/auth/auth.service.ts +++ b/kdb-web/src/app/services/auth/auth.service.ts @@ -258,7 +258,6 @@ export class AuthService { async isUserLoggedInAsync(): Promise { const token = this.getToken(); - console.log(1, token); if (!token || !token.refreshToken) { this.isLoggedIn$.next(false);