diff --git a/kdb-bot/src/bot/__init__.py b/kdb-bot/src/bot/__init__.py index ba527595..2f4dc7ca 100644 --- a/kdb-bot/src/bot/__init__.py +++ b/kdb-bot/src/bot/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot/bot.json b/kdb-bot/src/bot/bot.json index 7c2c7d72..9f0c063b 100644 --- a/kdb-bot/src/bot/bot.json +++ b/kdb-bot/src/bot/bot.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/src/bot/extension/__init__.py b/kdb-bot/src/bot/extension/__init__.py index 7ad01e6a..ab1e0d0c 100644 --- a/kdb-bot/src/bot/extension/__init__.py +++ b/kdb-bot/src/bot/extension/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot.extension" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index 82842240..3ab20a64 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -21,6 +21,7 @@ } }, "common": { + "feature_not_activated": "Diese Funktion ist deaktiviert", "bot_has_no_permission_message": "Ey!!!\nWas soll das?\nIch habe keine Berechtigungen :(\nScheiß System...", "colors": { "blue": "Blau", @@ -170,6 +171,11 @@ "error": { "nothing_found": "Keine Gameserver gefunden." }, + "list_members": { + "title": "Mitglieder", + "description": "Konfigurierte Mitglieder:", + "users": "Mitglieder" + }, "list": { "title": "Gameserver", "description": "Konfigurierte Gameserver:", @@ -351,6 +357,7 @@ "success": "API-Schlüssel wurde entfernt :D" } }, + "synced_message": "Der Sync wurde abgeschlossen.", "log_message": "Hier sind deine Logdateien! :)", "restart_message": "Bin gleich wieder da :D", "shutdown_message": "Trauert nicht um mich, es war eine logische Entscheidung. Das Wohl von Vielen, es wiegt schwerer als das Wohl von Wenigen oder eines Einzelnen. Ich war es und ich werde es immer sein, euer Freund. Lebt lange und in Frieden :)" diff --git a/kdb-bot/src/bot_api/__init__.py b/kdb-bot/src/bot_api/__init__.py index 269960ee..99edb8d3 100644 --- a/kdb-bot/src/bot_api/__init__.py +++ b/kdb-bot/src/bot_api/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/abc/__init__.py b/kdb-bot/src/bot_api/abc/__init__.py index 35fa1fdb..45d47bf7 100644 --- a/kdb-bot/src/bot_api/abc/__init__.py +++ b/kdb-bot/src/bot_api/abc/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.abc" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/bot-api.json b/kdb-bot/src/bot_api/bot-api.json index 0c1545c2..6f4d2c1c 100644 --- a/kdb-bot/src/bot_api/bot-api.json +++ b/kdb-bot/src/bot_api/bot-api.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "", "AuthorEmail": "", diff --git a/kdb-bot/src/bot_api/configuration/__init__.py b/kdb-bot/src/bot_api/configuration/__init__.py index 39440995..70de4cf2 100644 --- a/kdb-bot/src/bot_api/configuration/__init__.py +++ b/kdb-bot/src/bot_api/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.configuration" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/controller/__init__.py b/kdb-bot/src/bot_api/controller/__init__.py index 44630169..474d7841 100644 --- a/kdb-bot/src/bot_api/controller/__init__.py +++ b/kdb-bot/src/bot_api/controller/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.controller" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/event/__init__.py b/kdb-bot/src/bot_api/event/__init__.py index 29a738f0..7a3cc29f 100644 --- a/kdb-bot/src/bot_api/event/__init__.py +++ b/kdb-bot/src/bot_api/event/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.event" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/exception/__init__.py b/kdb-bot/src/bot_api/exception/__init__.py index c67b0743..55055c27 100644 --- a/kdb-bot/src/bot_api/exception/__init__.py +++ b/kdb-bot/src/bot_api/exception/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.exception" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/filter/__init__.py b/kdb-bot/src/bot_api/filter/__init__.py index 0087fabe..77145c97 100644 --- a/kdb-bot/src/bot_api/filter/__init__.py +++ b/kdb-bot/src/bot_api/filter/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.filter" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/filter/discord/__init__.py b/kdb-bot/src/bot_api/filter/discord/__init__.py index 0131021d..38245fe3 100644 --- a/kdb-bot/src/bot_api/filter/discord/__init__.py +++ b/kdb-bot/src/bot_api/filter/discord/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.filter.discord" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/logging/__init__.py b/kdb-bot/src/bot_api/logging/__init__.py index 0906b017..fcd37e0c 100644 --- a/kdb-bot/src/bot_api/logging/__init__.py +++ b/kdb-bot/src/bot_api/logging/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.logging" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/model/__init__.py b/kdb-bot/src/bot_api/model/__init__.py index a7c522ee..4d0b966b 100644 --- a/kdb-bot/src/bot_api/model/__init__.py +++ b/kdb-bot/src/bot_api/model/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.model" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/model/discord/__init__.py b/kdb-bot/src/bot_api/model/discord/__init__.py index 8b08b4af..d482dff9 100644 --- a/kdb-bot/src/bot_api/model/discord/__init__.py +++ b/kdb-bot/src/bot_api/model/discord/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.model.discord" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/route/__init__.py b/kdb-bot/src/bot_api/route/__init__.py index 23c285a3..1e63cbc6 100644 --- a/kdb-bot/src/bot_api/route/__init__.py +++ b/kdb-bot/src/bot_api/route/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.route" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/service/__init__.py b/kdb-bot/src/bot_api/service/__init__.py index fa013442..ba7b31ba 100644 --- a/kdb-bot/src/bot_api/service/__init__.py +++ b/kdb-bot/src/bot_api/service/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.service" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_api/transformer/__init__.py b/kdb-bot/src/bot_api/transformer/__init__.py index 4bedc5b2..93e08c87 100644 --- a/kdb-bot/src/bot_api/transformer/__init__.py +++ b/kdb-bot/src/bot_api/transformer/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_api.transformer" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/__init__.py b/kdb-bot/src/bot_core/__init__.py index 6c9c95f0..c5e0872a 100644 --- a/kdb-bot/src/bot_core/__init__.py +++ b/kdb-bot/src/bot_core/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/abc/__init__.py b/kdb-bot/src/bot_core/abc/__init__.py index 0b1bb8d3..452f6763 100644 --- a/kdb-bot/src/bot_core/abc/__init__.py +++ b/kdb-bot/src/bot_core/abc/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.abc" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/bot-core.json b/kdb-bot/src/bot_core/bot-core.json index f23a5213..384e8c4b 100644 --- a/kdb-bot/src/bot_core/bot-core.json +++ b/kdb-bot/src/bot_core/bot-core.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/src/bot_core/configuration/__init__.py b/kdb-bot/src/bot_core/configuration/__init__.py index c47c5d43..9e8b82e8 100644 --- a/kdb-bot/src/bot_core/configuration/__init__.py +++ b/kdb-bot/src/bot_core/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.configuration" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") 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 2ef3f70f..d91d18f4 100644 --- a/kdb-bot/src/bot_core/configuration/feature_flags_enum.py +++ b/kdb-bot/src/bot_core/configuration/feature_flags_enum.py @@ -20,3 +20,5 @@ class FeatureFlagsEnum(Enum): api_only = "ApiOnly" presence = "Presence" version_in_presence = "VersionInPresence" + game_server = "GameServer" + sync_xp = "SyncXp" 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 f132cc03..c90684a3 100644 --- a/kdb-bot/src/bot_core/configuration/feature_flags_settings.py +++ b/kdb-bot/src/bot_core/configuration/feature_flags_settings.py @@ -22,6 +22,8 @@ class FeatureFlagsSettings(ConfigurationModelABC): 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 + FeatureFlagsEnum.game_server.value: False, # 25.09.2023 #366 + FeatureFlagsEnum.sync_xp.value: False, # 25.09.2023 #366 } def __init__(self, **kwargs: dict): diff --git a/kdb-bot/src/bot_core/core_extension/__init__.py b/kdb-bot/src/bot_core/core_extension/__init__.py index 7220d75d..658eaffc 100644 --- a/kdb-bot/src/bot_core/core_extension/__init__.py +++ b/kdb-bot/src/bot_core/core_extension/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.core_extension" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/events/__init__.py b/kdb-bot/src/bot_core/events/__init__.py index 4ee3944d..c31d23d0 100644 --- a/kdb-bot/src/bot_core/events/__init__.py +++ b/kdb-bot/src/bot_core/events/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.events" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/exception/__init__.py b/kdb-bot/src/bot_core/exception/__init__.py index bdc6065f..96b2feae 100644 --- a/kdb-bot/src/bot_core/exception/__init__.py +++ b/kdb-bot/src/bot_core/exception/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.exception" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/helper/__init__.py b/kdb-bot/src/bot_core/helper/__init__.py index b6d63274..79023949 100644 --- a/kdb-bot/src/bot_core/helper/__init__.py +++ b/kdb-bot/src/bot_core/helper/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.helper" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/logging/__init__.py b/kdb-bot/src/bot_core/logging/__init__.py index 14e88ce2..23c4b996 100644 --- a/kdb-bot/src/bot_core/logging/__init__.py +++ b/kdb-bot/src/bot_core/logging/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.logging" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/pipes/__init__.py b/kdb-bot/src/bot_core/pipes/__init__.py index 477fb720..f4b9cbfe 100644 --- a/kdb-bot/src/bot_core/pipes/__init__.py +++ b/kdb-bot/src/bot_core/pipes/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.pipes" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_core/service/__init__.py b/kdb-bot/src/bot_core/service/__init__.py index 39d67732..8af6564f 100644 --- a/kdb-bot/src/bot_core/service/__init__.py +++ b/kdb-bot/src/bot_core/service/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_core.service" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_data/__init__.py b/kdb-bot/src/bot_data/__init__.py index f0e38948..cfda6242 100644 --- a/kdb-bot/src/bot_data/__init__.py +++ b/kdb-bot/src/bot_data/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_data" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_data/abc/__init__.py b/kdb-bot/src/bot_data/abc/__init__.py index 8cd8bc11..230338fc 100644 --- a/kdb-bot/src/bot_data/abc/__init__.py +++ b/kdb-bot/src/bot_data/abc/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_data.abc" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_data/abc/user_game_ident_repository_abc.py b/kdb-bot/src/bot_data/abc/user_game_ident_repository_abc.py index fbaa0831..ba45e02b 100644 --- a/kdb-bot/src/bot_data/abc/user_game_ident_repository_abc.py +++ b/kdb-bot/src/bot_data/abc/user_game_ident_repository_abc.py @@ -14,6 +14,10 @@ class UserGameIdentRepositoryABC(ABC): def get_user_game_idents(self) -> List[UserGameIdent]: pass + @abstractmethod + def get_user_game_idents_by_game_server_id(self, id: int) -> List[UserGameIdent]: + pass + @abstractmethod def get_user_game_ident_by_id(self, id: int) -> UserGameIdent: pass diff --git a/kdb-bot/src/bot_data/bot-data.json b/kdb-bot/src/bot_data/bot-data.json index a0d4ea5e..a808af01 100644 --- a/kdb-bot/src/bot_data/bot-data.json +++ b/kdb-bot/src/bot_data/bot-data.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/src/bot_data/migration/__init__.py b/kdb-bot/src/bot_data/migration/__init__.py index 7c54ab06..0fdf7f51 100644 --- a/kdb-bot/src/bot_data/migration/__init__.py +++ b/kdb-bot/src/bot_data/migration/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_data.migration" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_data/model/__init__.py b/kdb-bot/src/bot_data/model/__init__.py index 727c559e..b9b6a0e5 100644 --- a/kdb-bot/src/bot_data/model/__init__.py +++ b/kdb-bot/src/bot_data/model/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_data.model" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_data/model/user_game_ident.py b/kdb-bot/src/bot_data/model/user_game_ident.py index 22e7946f..79468d13 100644 --- a/kdb-bot/src/bot_data/model/user_game_ident.py +++ b/kdb-bot/src/bot_data/model/user_game_ident.py @@ -49,6 +49,15 @@ class UserGameIdent(TableABC): """ ) + @staticmethod + def get_select_by_game_server_id_string(id: int) -> str: + return str( + f""" + SELECT * FROM `UserGameIdents` + WHERE `GameServerId` = {id}; + """ + ) + @staticmethod def get_select_by_id_string(id: int) -> str: return str( diff --git a/kdb-bot/src/bot_data/service/__init__.py b/kdb-bot/src/bot_data/service/__init__.py index 94e9991b..1fac6c5f 100644 --- a/kdb-bot/src/bot_data/service/__init__.py +++ b/kdb-bot/src/bot_data/service/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_data.service" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_data/service/user_game_ident_repository_service.py b/kdb-bot/src/bot_data/service/user_game_ident_repository_service.py index 5967d78b..d0dfc38b 100644 --- a/kdb-bot/src/bot_data/service/user_game_ident_repository_service.py +++ b/kdb-bot/src/bot_data/service/user_game_ident_repository_service.py @@ -51,6 +51,19 @@ class UserGameIdentRepositoryService(UserGameIdentRepositoryABC): return joins + def get_user_game_idents_by_game_server_id(self, game_server_id: int) -> List[UserGameIdent]: + joins = List(UserGameIdent) + self._logger.trace( + __name__, + f"Send SQL command: {UserGameIdent.get_select_by_game_server_id_string(game_server_id)}", + ) + results = self._context.select(UserGameIdent.get_select_by_game_server_id_string(game_server_id)) + for result in results: + self._logger.trace(__name__, f"Get UserGameIdent with id {result[0]}") + joins.append(self._from_result(result)) + + return joins + def get_user_game_ident_by_id(self, id: int) -> UserGameIdent: self._logger.trace( __name__, diff --git a/kdb-bot/src/bot_graphql/__init__.py b/kdb-bot/src/bot_graphql/__init__.py index af05407b..4272d8e2 100644 --- a/kdb-bot/src/bot_graphql/__init__.py +++ b/kdb-bot/src/bot_graphql/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_graphql" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_graphql/abc/__init__.py b/kdb-bot/src/bot_graphql/abc/__init__.py index 4fe43bb3..d723ec75 100644 --- a/kdb-bot/src/bot_graphql/abc/__init__.py +++ b/kdb-bot/src/bot_graphql/abc/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_graphql.abc" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_graphql/bot-graphql.json b/kdb-bot/src/bot_graphql/bot-graphql.json index 6baa75f3..d42e532e 100644 --- a/kdb-bot/src/bot_graphql/bot-graphql.json +++ b/kdb-bot/src/bot_graphql/bot-graphql.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/src/bot_graphql/filter/__init__.py b/kdb-bot/src/bot_graphql/filter/__init__.py index f0c4de6a..00ce8266 100644 --- a/kdb-bot/src/bot_graphql/filter/__init__.py +++ b/kdb-bot/src/bot_graphql/filter/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_graphql.filter" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_graphql/model/__init__.py b/kdb-bot/src/bot_graphql/model/__init__.py index 140cd7ec..9bacb226 100644 --- a/kdb-bot/src/bot_graphql/model/__init__.py +++ b/kdb-bot/src/bot_graphql/model/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_graphql.model" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_graphql/mutations/__init__.py b/kdb-bot/src/bot_graphql/mutations/__init__.py index 10df39e1..09ed2432 100644 --- a/kdb-bot/src/bot_graphql/mutations/__init__.py +++ b/kdb-bot/src/bot_graphql/mutations/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_graphql.mutations" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py b/kdb-bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py index 957b3a86..9225299d 100644 --- a/kdb-bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py +++ b/kdb-bot/src/bot_graphql/mutations/user_joined_game_server_mutation.py @@ -9,6 +9,8 @@ from cpl_discord.service import DiscordBotServiceABC from flask import request from bot_api.configuration.authentication_settings import AuthenticationSettings +from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum +from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings from bot_data.abc.api_key_repository_abc import ApiKeyRepositoryABC from bot_data.abc.game_server_repository_abc import GameServerRepositoryABC from bot_data.abc.server_repository_abc import ServerRepositoryABC @@ -77,6 +79,11 @@ class UserJoinedGameServerMutation(QueryABC): def resolve_user_joined(self, *_, input: dict): game_ident = self._user_game_idents.get_user_game_ident_by_ident(input["ident"]) user = game_ident.user + + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}") + if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): + raise Exception("Feature not activated") + self._can_user_mutate_data(user.server, UserRoleEnum.admin) active = self._user_joined_game_servers.find_active_user_joined_game_server_by_user_id(user.id) @@ -98,6 +105,11 @@ class UserJoinedGameServerMutation(QueryABC): if game_ident is None: return user = game_ident.user + + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{user.server.discord_id}") + if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): + raise Exception("Feature not activated") + self._can_user_mutate_data(user.server, UserRoleEnum.admin) active = self._user_joined_game_servers.find_active_user_joined_game_server_by_user_id(user.id) diff --git a/kdb-bot/src/bot_graphql/queries/__init__.py b/kdb-bot/src/bot_graphql/queries/__init__.py index 4c346e1b..af3a9fdf 100644 --- a/kdb-bot/src/bot_graphql/queries/__init__.py +++ b/kdb-bot/src/bot_graphql/queries/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_graphql.queries" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/bot_graphql/queries/discord/__init__.py b/kdb-bot/src/bot_graphql/queries/discord/__init__.py index 2650b403..a4425748 100644 --- a/kdb-bot/src/bot_graphql/queries/discord/__init__.py +++ b/kdb-bot/src/bot_graphql/queries/discord/__init__.py @@ -15,7 +15,7 @@ __title__ = "bot_graphql.queries.discord" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/achievements/__init__.py b/kdb-bot/src/modules/achievements/__init__.py index b6088f58..eda08773 100644 --- a/kdb-bot/src/modules/achievements/__init__.py +++ b/kdb-bot/src/modules/achievements/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.achievements" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/achievements/achievements.json b/kdb-bot/src/modules/achievements/achievements.json index cdaf51ad..e11f0f63 100644 --- a/kdb-bot/src/modules/achievements/achievements.json +++ b/kdb-bot/src/modules/achievements/achievements.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/src/modules/achievements/commands/__init__.py b/kdb-bot/src/modules/achievements/commands/__init__.py index 43edf1a9..dbff52dc 100644 --- a/kdb-bot/src/modules/achievements/commands/__init__.py +++ b/kdb-bot/src/modules/achievements/commands/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.achievements.commands" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/achievements/events/__init__.py b/kdb-bot/src/modules/achievements/events/__init__.py index 0dd3e8a3..dfaa74e8 100644 --- a/kdb-bot/src/modules/achievements/events/__init__.py +++ b/kdb-bot/src/modules/achievements/events/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.achievements.events" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/achievements/model/__init__.py b/kdb-bot/src/modules/achievements/model/__init__.py index 8b28e3c5..d803c190 100644 --- a/kdb-bot/src/modules/achievements/model/__init__.py +++ b/kdb-bot/src/modules/achievements/model/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.achievements.model" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/auto_role/__init__.py b/kdb-bot/src/modules/auto_role/__init__.py index 612224db..47815bd7 100644 --- a/kdb-bot/src/modules/auto_role/__init__.py +++ b/kdb-bot/src/modules/auto_role/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.auto_role" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/auto_role/auto-role.json b/kdb-bot/src/modules/auto_role/auto-role.json index 53f4e4c4..4609845a 100644 --- a/kdb-bot/src/modules/auto_role/auto-role.json +++ b/kdb-bot/src/modules/auto_role/auto-role.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "", "AuthorEmail": "", diff --git a/kdb-bot/src/modules/auto_role/command/__init__.py b/kdb-bot/src/modules/auto_role/command/__init__.py index 043689f2..9bcc8212 100644 --- a/kdb-bot/src/modules/auto_role/command/__init__.py +++ b/kdb-bot/src/modules/auto_role/command/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.auto_role.command" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/auto_role/events/__init__.py b/kdb-bot/src/modules/auto_role/events/__init__.py index bc7bdb17..a3cbb613 100644 --- a/kdb-bot/src/modules/auto_role/events/__init__.py +++ b/kdb-bot/src/modules/auto_role/events/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.auto_role.events" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/auto_role/helper/__init__.py b/kdb-bot/src/modules/auto_role/helper/__init__.py index cfa44e32..16d38163 100644 --- a/kdb-bot/src/modules/auto_role/helper/__init__.py +++ b/kdb-bot/src/modules/auto_role/helper/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.auto_role.helper" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/base/__init__.py b/kdb-bot/src/modules/base/__init__.py index 8f35b750..dfc3a901 100644 --- a/kdb-bot/src/modules/base/__init__.py +++ b/kdb-bot/src/modules/base/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.base" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/base/base.json b/kdb-bot/src/modules/base/base.json index fb0d07f4..c5b462df 100644 --- a/kdb-bot/src/modules/base/base.json +++ b/kdb-bot/src/modules/base/base.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "", "AuthorEmail": "", diff --git a/kdb-bot/src/modules/base/command/__init__.py b/kdb-bot/src/modules/base/command/__init__.py index ac306bda..73da5488 100644 --- a/kdb-bot/src/modules/base/command/__init__.py +++ b/kdb-bot/src/modules/base/command/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.base.command" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/base/command/game_server_group.py b/kdb-bot/src/modules/base/command/game_server_group.py index 7d3073be..b822f3de 100644 --- a/kdb-bot/src/modules/base/command/game_server_group.py +++ b/kdb-bot/src/modules/base/command/game_server_group.py @@ -1,6 +1,7 @@ from typing import List as TList import discord +from cpl_core.configuration import ConfigurationABC from cpl_core.database.context import DatabaseContextABC from cpl_discord.command import DiscordCommandABC from cpl_discord.service import DiscordBotServiceABC @@ -11,38 +12,49 @@ from discord.ext.commands import Context from bot_core.abc.client_utils_abc import ClientUtilsABC from bot_core.abc.message_service_abc import MessageServiceABC +from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum +from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings from bot_core.helper.command_checks import CommandChecks from bot_core.logging.command_logger import CommandLogger from bot_data.abc.api_key_repository_abc import ApiKeyRepositoryABC from bot_data.abc.game_server_repository_abc import GameServerRepositoryABC from bot_data.abc.server_repository_abc import ServerRepositoryABC +from bot_data.abc.user_game_ident_repository_abc import UserGameIdentRepositoryABC +from bot_data.abc.user_repository_abc import UserRepositoryABC from bot_data.model.game_server import GameServer +from bot_data.model.server_config import ServerConfig from modules.permission.abc.permission_service_abc import PermissionServiceABC class GameServerGroup(DiscordCommandABC): def __init__( self, + config: ConfigurationABC, logger: CommandLogger, message_service: MessageServiceABC, bot: DiscordBotServiceABC, client_utils: ClientUtilsABC, translate: TranslatePipe, servers: ServerRepositoryABC, + user: UserRepositoryABC, game_servers: GameServerRepositoryABC, + user_game_idents: UserGameIdentRepositoryABC, api_keys: ApiKeyRepositoryABC, db: DatabaseContextABC, permission_service: PermissionServiceABC, ): DiscordCommandABC.__init__(self) + self._config = config self._logger = logger self._message_service = message_service self._bot = bot self._client_utils = client_utils self._t = translate self._servers = servers + self._user = user self._game_servers = game_servers + self._user_game_idents = user_game_idents self._api_keys = api_keys self._db = db self._permissions = permission_service @@ -64,6 +76,11 @@ class GameServerGroup(DiscordCommandABC): if ctx.guild is None: return + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): + await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + return + server = self._servers.get_server_by_discord_id(ctx.guild.id) game_servers = self._game_servers.get_game_servers_by_server_id(server.id) if game_servers.count() < 1: @@ -102,6 +119,14 @@ class GameServerGroup(DiscordCommandABC): async def add(self, ctx: Context, name: str, api_key_id: int): self._logger.debug(__name__, f"Received command game-server add {ctx}: {name} {api_key_id}") + if ctx.guild is None: + return + + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): + await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + return + server = self._servers.get_server_by_discord_id(ctx.guild.id) api_key = self._api_keys.get_api_key_by_id(api_key_id) game_server = GameServer(name, server, api_key) @@ -133,6 +158,14 @@ class GameServerGroup(DiscordCommandABC): async def remove(self, ctx: Context, id: int): self._logger.debug(__name__, f"Received command game-server remove {ctx}: {id}") + if ctx.guild is None: + return + + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): + await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + return + game_server = self._game_servers.get_game_server_by_id(id) self._game_servers.delete_game_server(game_server) self._db.save_changes() @@ -149,3 +182,44 @@ class GameServerGroup(DiscordCommandABC): app_commands.Choice(name=gs.name, value=gs.id) for gs in self._client_utils.get_auto_complete_list(game_servers, current, lambda x: x.name) ] + + @game_server.command(name="list-members") + @commands.guild_only() + @CommandChecks.check_is_ready() + @CommandChecks.check_is_member_moderator() + async def list_members(self, ctx: Context, id: int, wait: int = None): + self._logger.debug(__name__, f"Received command game-server remove {ctx}: {id}") + + if ctx.guild is None: + return + + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server): + await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + return + + game_server = self._game_servers.get_game_server_by_id(id) + game_idents = self._user_game_idents.get_user_game_idents_by_game_server_id(game_server.id) + users = "" + for game_ident in game_idents: + users += f"\n{game_ident.user.name}" + + embed = discord.Embed( + title=self._t.transform("modules.base.game_server.list_members.title"), + description=self._t.transform("modules.base.game_server.list_members.description"), + color=int("ef9d0d", 16), + ) + embed.add_field(name=self._t.transform("modules.base.game_server.list_members.users"), value=users, inline=True) + await self._message_service.send_ctx_msg(ctx, embed, wait_before_delete=wait) + + self._logger.trace(__name__, f"Finished command game-server remove") + + @list_members.autocomplete("id") + async def id_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + server = self._servers.get_server_by_discord_id(interaction.guild.id) + game_servers = self._game_servers.get_game_servers_by_server_id(server.id) + + return [ + app_commands.Choice(name=gs.name, value=gs.id) + for gs in self._client_utils.get_auto_complete_list(game_servers, current, lambda x: x.name) + ] diff --git a/kdb-bot/src/modules/base/events/__init__.py b/kdb-bot/src/modules/base/events/__init__.py index d2f7d6e8..ad93bb83 100644 --- a/kdb-bot/src/modules/base/events/__init__.py +++ b/kdb-bot/src/modules/base/events/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.base.events" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/base/forms/__init__.py b/kdb-bot/src/modules/base/forms/__init__.py index 3393904e..340c079a 100644 --- a/kdb-bot/src/modules/base/forms/__init__.py +++ b/kdb-bot/src/modules/base/forms/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.base.forms" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/base/helper/__init__.py b/kdb-bot/src/modules/base/helper/__init__.py index 575e38da..4d715c27 100644 --- a/kdb-bot/src/modules/base/helper/__init__.py +++ b/kdb-bot/src/modules/base/helper/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.base.helper" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/base/model/__init__.py b/kdb-bot/src/modules/base/model/__init__.py index 9ed856c3..aaaa2bd4 100644 --- a/kdb-bot/src/modules/base/model/__init__.py +++ b/kdb-bot/src/modules/base/model/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.base.model" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/base/service/__init__.py b/kdb-bot/src/modules/base/service/__init__.py index 5b859408..59c5de9b 100644 --- a/kdb-bot/src/modules/base/service/__init__.py +++ b/kdb-bot/src/modules/base/service/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.base.service" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/base/thread/__init__.py b/kdb-bot/src/modules/base/thread/__init__.py index 7bf11050..daccd3b7 100644 --- a/kdb-bot/src/modules/base/thread/__init__.py +++ b/kdb-bot/src/modules/base/thread/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.base.thread" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/boot_log/__init__.py b/kdb-bot/src/modules/boot_log/__init__.py index 5fa6a231..37cba8a2 100644 --- a/kdb-bot/src/modules/boot_log/__init__.py +++ b/kdb-bot/src/modules/boot_log/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.boot_log" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/boot_log/boot-log.json b/kdb-bot/src/modules/boot_log/boot-log.json index b0452fc4..351f7fbb 100644 --- a/kdb-bot/src/modules/boot_log/boot-log.json +++ b/kdb-bot/src/modules/boot_log/boot-log.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "", "AuthorEmail": "", diff --git a/kdb-bot/src/modules/config/__init__.py b/kdb-bot/src/modules/config/__init__.py index e3d8f0f7..0330d875 100644 --- a/kdb-bot/src/modules/config/__init__.py +++ b/kdb-bot/src/modules/config/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.config" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/config/config.json b/kdb-bot/src/modules/config/config.json index 38dbbfb4..a0d39cf8 100644 --- a/kdb-bot/src/modules/config/config.json +++ b/kdb-bot/src/modules/config/config.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "", "AuthorEmail": "", diff --git a/kdb-bot/src/modules/config/events/__init__.py b/kdb-bot/src/modules/config/events/__init__.py index 57b1c142..a19fb622 100644 --- a/kdb-bot/src/modules/config/events/__init__.py +++ b/kdb-bot/src/modules/config/events/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.config.events" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/config/service/__init__.py b/kdb-bot/src/modules/config/service/__init__.py index 7b723c97..f3869c77 100644 --- a/kdb-bot/src/modules/config/service/__init__.py +++ b/kdb-bot/src/modules/config/service/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.config.service" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/database/__init__.py b/kdb-bot/src/modules/database/__init__.py index 64bff948..4605835b 100644 --- a/kdb-bot/src/modules/database/__init__.py +++ b/kdb-bot/src/modules/database/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.database" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/database/database.json b/kdb-bot/src/modules/database/database.json index 963f4aef..c0f5e616 100644 --- a/kdb-bot/src/modules/database/database.json +++ b/kdb-bot/src/modules/database/database.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/src/modules/level/__init__.py b/kdb-bot/src/modules/level/__init__.py index 5d17d13b..6d650e08 100644 --- a/kdb-bot/src/modules/level/__init__.py +++ b/kdb-bot/src/modules/level/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.level" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/level/command/__init__.py b/kdb-bot/src/modules/level/command/__init__.py index 5e475525..958058b4 100644 --- a/kdb-bot/src/modules/level/command/__init__.py +++ b/kdb-bot/src/modules/level/command/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.level.command" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/level/configuration/__init__.py b/kdb-bot/src/modules/level/configuration/__init__.py index 305d8ecf..1340f77d 100644 --- a/kdb-bot/src/modules/level/configuration/__init__.py +++ b/kdb-bot/src/modules/level/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.level.configuration" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/level/events/__init__.py b/kdb-bot/src/modules/level/events/__init__.py index 6b0ad040..1c7d6538 100644 --- a/kdb-bot/src/modules/level/events/__init__.py +++ b/kdb-bot/src/modules/level/events/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.level.events" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/level/level.json b/kdb-bot/src/modules/level/level.json index 9739548e..aac241e5 100644 --- a/kdb-bot/src/modules/level/level.json +++ b/kdb-bot/src/modules/level/level.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "", "AuthorEmail": "", diff --git a/kdb-bot/src/modules/level/service/__init__.py b/kdb-bot/src/modules/level/service/__init__.py index 8912af39..baf51d2f 100644 --- a/kdb-bot/src/modules/level/service/__init__.py +++ b/kdb-bot/src/modules/level/service/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.level.service" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/permission/__init__.py b/kdb-bot/src/modules/permission/__init__.py index 14860e07..50356dc0 100644 --- a/kdb-bot/src/modules/permission/__init__.py +++ b/kdb-bot/src/modules/permission/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.permission" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/permission/abc/__init__.py b/kdb-bot/src/modules/permission/abc/__init__.py index 36f3d502..4ded6a8e 100644 --- a/kdb-bot/src/modules/permission/abc/__init__.py +++ b/kdb-bot/src/modules/permission/abc/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.permission.abc" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/permission/events/__init__.py b/kdb-bot/src/modules/permission/events/__init__.py index b3297d59..046d7be3 100644 --- a/kdb-bot/src/modules/permission/events/__init__.py +++ b/kdb-bot/src/modules/permission/events/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.permission.events" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/permission/permission.json b/kdb-bot/src/modules/permission/permission.json index 8a070e7b..7b90445a 100644 --- a/kdb-bot/src/modules/permission/permission.json +++ b/kdb-bot/src/modules/permission/permission.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "", "AuthorEmail": "", diff --git a/kdb-bot/src/modules/permission/service/__init__.py b/kdb-bot/src/modules/permission/service/__init__.py index 460a5190..171cdfa0 100644 --- a/kdb-bot/src/modules/permission/service/__init__.py +++ b/kdb-bot/src/modules/permission/service/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.permission.service" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/technician/__init__.py b/kdb-bot/src/modules/technician/__init__.py index a1083256..0e73eb44 100644 --- a/kdb-bot/src/modules/technician/__init__.py +++ b/kdb-bot/src/modules/technician/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.technician" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/technician/command/__init__.py b/kdb-bot/src/modules/technician/command/__init__.py index 15d38112..260f7e77 100644 --- a/kdb-bot/src/modules/technician/command/__init__.py +++ b/kdb-bot/src/modules/technician/command/__init__.py @@ -15,7 +15,7 @@ __title__ = "modules.technician.command" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "1.1.5" +__version__ = "1.1.6" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="1", minor="1", micro="5") +version_info = VersionInfo(major="1", minor="1", micro="6") diff --git a/kdb-bot/src/modules/technician/command/sync_xp_command.py b/kdb-bot/src/modules/technician/command/sync_xp_command.py new file mode 100644 index 00000000..73b810d5 --- /dev/null +++ b/kdb-bot/src/modules/technician/command/sync_xp_command.py @@ -0,0 +1,156 @@ +import discord +from cpl_core.configuration import ConfigurationABC +from cpl_core.database.context import DatabaseContextABC +from cpl_discord.command import DiscordCommandABC +from cpl_discord.service import DiscordBotServiceABC +from cpl_translation import TranslatePipe +from discord import app_commands +from discord.ext import commands +from discord.ext.commands import Context + +from bot_core.abc.client_utils_abc import ClientUtilsABC +from bot_core.abc.message_service_abc import MessageServiceABC +from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum +from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings +from bot_core.helper.command_checks import CommandChecks +from bot_core.logging.command_logger import CommandLogger +from bot_data.abc.server_repository_abc import ServerRepositoryABC +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.permission.abc.permission_service_abc import PermissionServiceABC + + +class SyncXpGroup(DiscordCommandABC): + def __init__( + self, + logger: CommandLogger, + config: ConfigurationABC, + message_service: MessageServiceABC, + bot: DiscordBotServiceABC, + client_utils: ClientUtilsABC, + translate: TranslatePipe, + servers: ServerRepositoryABC, + users: UserRepositoryABC, + permissions: PermissionServiceABC, + settings: TechnicianConfig, + db: DatabaseContextABC, + ): + DiscordCommandABC.__init__(self) + + self._logger = logger + self._config = config + self._message_service = message_service + self._bot = bot + self._client_utils = client_utils + self._t = translate + self._servers = servers + self._users = users + self._permissions = permissions + self._settings = settings + self._db = db + + self._logger.trace(__name__, f"Loaded command service: {type(self).__name__}") + + @commands.hybrid_group(name="sync-xp") + @commands.guild_only() + async def sync_xp(self, ctx: Context): + pass + + @sync_xp.command(name="all-members") + @commands.guild_only() + @CommandChecks.check_is_ready() + @CommandChecks.check_is_member_technician() + async def all_members(self, ctx: Context, server_id: int): + self._logger.debug(__name__, f"Received command sync xp {ctx}") + + if ctx.guild is None: + return + + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.sync_xp): + await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + return + + other_server = self._servers.get_server_by_id(server_id) + users_on_other_server = self._users.get_users_by_server_id(other_server.id).where(lambda x: not x.left_server) + discord_ids_on_other_server = users_on_other_server.select(lambda x: x.discord_id) + + for user in self._users.get_users_by_server_id(self._servers.get_server_by_discord_id(ctx.guild.id).id).where( + lambda x: not x.left_server + ): + try: + if user.discord_id not in discord_ids_on_other_server: + continue + + user_on_other_server: User = users_on_other_server.where( + lambda x: x.discord_id == user.discord_id + ).first_or_default() + if user_on_other_server is None or user_on_other_server.xp <= user.xp: + continue + + user.xp = user_on_other_server.xp + self._users.update_user(user) + self._db.save_changes() + except Exception as e: + 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")) + self._logger.trace(__name__, f"Finished sync xp command") + + @all_members.autocomplete("server_id") + async def list_autocomplete(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice]: + return [ + app_commands.Choice(name=server.name, value=server.id) + for server in self._client_utils.get_auto_complete_list( + self._servers.get_servers(), current, lambda x: x.name + ) + ] + + @sync_xp.command(name="by_member") + @commands.guild_only() + @CommandChecks.check_is_ready() + @CommandChecks.check_is_member_technician() + async def by_member(self, ctx: Context, server_id: int, member: discord.Member): + self._logger.debug(__name__, f"Received command sync xp {ctx}") + + if ctx.guild is None: + return + + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}") + if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.sync_xp): + await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated")) + return + + other_server = self._servers.get_server_by_id(server_id) + user = self._users.get_user_by_discord_id_and_server_id( + self._servers.get_server_by_discord_id(ctx.guild.id).id, member.id + ) + + try: + user_on_other_server = ( + self._users.get_users_by_server_id(other_server.id) + .where(lambda x: x.discord_id == member.id) + .first_or_default() + ) + if user_on_other_server is None or user_on_other_server.xp <= user.xp: + return + + user.xp = user_on_other_server.xp + self._users.update_user(user) + self._db.save_changes() + except Exception as e: + 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")) + self._logger.trace(__name__, f"Finished sync xp command") + + @by_member.autocomplete("server_id") + async def list_autocomplete(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice]: + return [ + app_commands.Choice(name=server.name, value=server.id) + for server in self._client_utils.get_auto_complete_list( + self._servers.get_servers(), current, lambda x: x.name + ) + ] diff --git a/kdb-bot/src/modules/technician/technician.json b/kdb-bot/src/modules/technician/technician.json index afebba63..1fb18154 100644 --- a/kdb-bot/src/modules/technician/technician.json +++ b/kdb-bot/src/modules/technician/technician.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "", "AuthorEmail": "", diff --git a/kdb-bot/src/modules/technician/technician_module.py b/kdb-bot/src/modules/technician/technician_module.py index 57282ebc..5d5472ba 100644 --- a/kdb-bot/src/modules/technician/technician_module.py +++ b/kdb-bot/src/modules/technician/technician_module.py @@ -11,6 +11,7 @@ from modules.technician.command.api_key_group import ApiKeyGroup from modules.technician.command.log_command import LogCommand from modules.technician.command.restart_command import RestartCommand from modules.technician.command.shutdown_command import ShutdownCommand +from modules.technician.command.sync_xp_command import SyncXpGroup class TechnicianModule(ModuleABC): @@ -27,4 +28,5 @@ class TechnicianModule(ModuleABC): self._dc.add_command(ShutdownCommand) self._dc.add_command(LogCommand) self._dc.add_command(ApiKeyGroup) + self._dc.add_command(SyncXpGroup) # events diff --git a/kdb-bot/tools/checks/checks.json b/kdb-bot/tools/checks/checks.json index 77f5005a..343cbdf4 100644 --- a/kdb-bot/tools/checks/checks.json +++ b/kdb-bot/tools/checks/checks.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/tools/get_version/get-version.json b/kdb-bot/tools/get_version/get-version.json index c2d46a06..c9a5c83b 100644 --- a/kdb-bot/tools/get_version/get-version.json +++ b/kdb-bot/tools/get_version/get-version.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/tools/post_build/post-build.json b/kdb-bot/tools/post_build/post-build.json index 6c560832..40a46e27 100644 --- a/kdb-bot/tools/post_build/post-build.json +++ b/kdb-bot/tools/post_build/post-build.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-bot/tools/set_version/set-version.json b/kdb-bot/tools/set_version/set-version.json index c04415ce..f547987d 100644 --- a/kdb-bot/tools/set_version/set-version.json +++ b/kdb-bot/tools/set_version/set-version.json @@ -4,7 +4,7 @@ "Version": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/kdb-web/package.json b/kdb-web/package.json index 1767fbc1..59943f80 100644 --- a/kdb-web/package.json +++ b/kdb-web/package.json @@ -1,6 +1,6 @@ { "name": "kdb-web", - "version": "1.1.5", + "version": "1.1.6", "scripts": { "ng": "ng", "update-version": "ts-node update-version.ts", @@ -51,4 +51,4 @@ "tslib": "^2.4.1", "typescript": "~4.9.5" } -} +} \ No newline at end of file diff --git a/kdb-web/src/assets/version.json b/kdb-web/src/assets/version.json index c05e15af..e6fe0a48 100644 --- a/kdb-web/src/assets/version.json +++ b/kdb-web/src/assets/version.json @@ -2,6 +2,6 @@ "WebVersion": { "Major": "1", "Minor": "1", - "Micro": "5" + "Micro": "6" } -} +} \ No newline at end of file