From 81c2f1cba9d99be718f2f310b23be4cdaadc7b32 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 13 Jun 2023 15:38:04 +0200 Subject: [PATCH] Fixed discord service config loading --- src/cpl_discord/.cpl/__init__.py | 4 ++-- src/cpl_discord/__init__.py | 4 ++-- src/cpl_discord/application/__init__.py | 4 ++-- src/cpl_discord/command/__init__.py | 4 ++-- src/cpl_discord/configuration/__init__.py | 4 ++-- src/cpl_discord/container/__init__.py | 4 ++-- src/cpl_discord/cpl-discord.json | 2 +- src/cpl_discord/events/__init__.py | 4 ++-- src/cpl_discord/helper/__init__.py | 4 ++-- src/cpl_discord/service/__init__.py | 4 ++-- src/cpl_discord/service/discord_bot_service.py | 13 ++++++------- 11 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/cpl_discord/.cpl/__init__.py b/src/cpl_discord/.cpl/__init__.py index 817f9eb0..aefe2fd8 100644 --- a/src/cpl_discord/.cpl/__init__.py +++ b/src/cpl_discord/.cpl/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/__init__.py b/src/cpl_discord/__init__.py index f0ac26db..95763308 100644 --- a/src/cpl_discord/__init__.py +++ b/src/cpl_discord/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -59,4 +59,4 @@ def get_discord_collection(services: "ServiceCollectionABC") -> "DiscordCollecti # build-ignore-end VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/application/__init__.py b/src/cpl_discord/application/__init__.py index 46c925d3..0561a912 100644 --- a/src/cpl_discord/application/__init__.py +++ b/src/cpl_discord/application/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord.application" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -24,4 +24,4 @@ from collections import namedtuple from .discord_bot_application_abc import DiscordBotApplicationABC VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/command/__init__.py b/src/cpl_discord/command/__init__.py index 51e90f17..6de7d6d1 100644 --- a/src/cpl_discord/command/__init__.py +++ b/src/cpl_discord/command/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord.command" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -25,4 +25,4 @@ from .discord_command_abc import DiscordCommandABC from .discord_commands_meta import DiscordCogMeta VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/configuration/__init__.py b/src/cpl_discord/configuration/__init__.py index 1c64d289..13b46e90 100644 --- a/src/cpl_discord/configuration/__init__.py +++ b/src/cpl_discord/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord.configuration" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -24,4 +24,4 @@ from collections import namedtuple from .discord_bot_settings import DiscordBotSettings VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/container/__init__.py b/src/cpl_discord/container/__init__.py index 45e09573..eeb810a9 100644 --- a/src/cpl_discord/container/__init__.py +++ b/src/cpl_discord/container/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord.container" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -31,4 +31,4 @@ from .thread import Thread from .voice_channel import VoiceChannel VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/cpl-discord.json b/src/cpl_discord/cpl-discord.json index 86c78c8a..1d59031e 100644 --- a/src/cpl_discord/cpl-discord.json +++ b/src/cpl_discord/cpl-discord.json @@ -4,7 +4,7 @@ "Version": { "Major": "2023", "Minor": "4", - "Micro": "0.post1" + "Micro": "0.post2" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_discord/events/__init__.py b/src/cpl_discord/events/__init__.py index 1f1c5131..80164c3b 100644 --- a/src/cpl_discord/events/__init__.py +++ b/src/cpl_discord/events/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord.events" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -69,4 +69,4 @@ from .on_voice_state_update_abc import OnVoiceStateUpdateABC from .on_webhooks_update_abc import OnWebhooksUpdateABC VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/helper/__init__.py b/src/cpl_discord/helper/__init__.py index 153af02f..8214211d 100644 --- a/src/cpl_discord/helper/__init__.py +++ b/src/cpl_discord/helper/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord.helper" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -24,4 +24,4 @@ from collections import namedtuple from .to_containers_converter import ToContainersConverter VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/service/__init__.py b/src/cpl_discord/service/__init__.py index 79acd9ab..0d670dfe 100644 --- a/src/cpl_discord/service/__init__.py +++ b/src/cpl_discord/service/__init__.py @@ -15,7 +15,7 @@ __title__ = "cpl_discord.service" __author__ = "Sven Heidemann" __license__ = "MIT" __copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" -__version__ = "2023.4.0.post1" +__version__ = "2023.4.0.post2" from collections import namedtuple @@ -29,4 +29,4 @@ from .discord_service import DiscordService from .discord_service_abc import DiscordServiceABC VersionInfo = namedtuple("VersionInfo", "major minor micro") -version_info = VersionInfo(major="2023", minor="4", micro="0.post1") +version_info = VersionInfo(major="2023", minor="4", micro="0.post2") diff --git a/src/cpl_discord/service/discord_bot_service.py b/src/cpl_discord/service/discord_bot_service.py index 07873a11..4213eabd 100644 --- a/src/cpl_discord/service/discord_bot_service.py +++ b/src/cpl_discord/service/discord_bot_service.py @@ -56,14 +56,13 @@ class DiscordBotService(DiscordBotServiceABC): env_token = self._config.get_configuration("TOKEN") env_prefix = self._config.get_configuration("PREFIX") - new_settings.from_dict( - { - "Token": env_token if token is None or token == "" else token, - "Prefix": ("! " if self._is_string_invalid(env_prefix) else env_prefix) - if self._is_string_invalid(prefix) - else prefix, - } + new_settings = DiscordBotSettings( + env_token if token is None or token == "" else token, + ("! " if self._is_string_invalid(env_prefix) else env_prefix) + if self._is_string_invalid(prefix) + else prefix, ) + if new_settings.token is None or new_settings.token == "": raise Exception("You have to configure discord token by appsettings or environment variables") return new_settings