Added settings

This commit is contained in:
Cora Cordes 2022-01-07 13:17:00 +01:00
parent c9a5a64c7b
commit dc025170e1
2 changed files with 8 additions and 1 deletions

View File

@ -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
}
}

View File

@ -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()}')