From dc025170e133cb1e030b0af7f73ae2166a380711 Mon Sep 17 00:00:00 2001 From: Cora Cordes Date: Fri, 7 Jan 2022 13:17:00 +0100 Subject: [PATCH] Added settings --- src/gismo/config/base.json | 3 ++- src/modules/base/base_settings.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gismo/config/base.json b/src/gismo/config/base.json index 631149a..29066cc 100644 --- a/src/gismo/config/base.json +++ b/src/gismo/config/base.json @@ -11,6 +11,7 @@ 910199452915093594 ], "PurgeMessage": "Ja mein Herr, ich lösche alle Nachrichten!", - "NoPermissionsMessage": "Nein!\nIch höre nicht auf dich ¯\\_(ツ)_/¯" + "NoPermissionsMessage": "Nein!\nIch höre nicht auf dich ¯\\_(ツ)_/¯", + "AFKCommandChannelId": 910199452915093594 } } \ No newline at end of file diff --git a/src/modules/base/base_settings.py b/src/modules/base/base_settings.py index fbd7eaf..c2346d4 100644 --- a/src/modules/base/base_settings.py +++ b/src/modules/base/base_settings.py @@ -18,6 +18,7 @@ class BaseSettings(ConfigurationModelABC): self._afk_channel_ids: list[int] = [] self._purge_message: str = '' self._no_permissions_message: str = '' + self._afk_command_channel_id: int = 0 @property def welcome_message(self) -> str: @@ -55,6 +56,10 @@ class BaseSettings(ConfigurationModelABC): def no_permissions_message(self) -> str: return self._no_permissions_message + @property + def afk_command_channel_ids(self) -> int: + return self._afk_command_channel_id + def from_dict(self, settings: dict): try: self._welcome_message = settings['WelcomeMessage'] @@ -67,6 +72,7 @@ class BaseSettings(ConfigurationModelABC): self._afk_channel_ids.append(int(id)) self._purge_message = settings['PurgeMessage'] self._no_permissions_message = settings['NoPermissionsMessage'] + self._afk_command_channel_id = settings['AFKCommandChannelId'] except Exception as e: Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings') Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')