Fixed server config #378

This commit is contained in:
Sven Heidemann 2023-09-28 11:30:58 +02:00
parent 4c0a4bc1ae
commit fe42d46a38

View File

@ -1,5 +1,6 @@
import json
from datetime import datetime
from typing import Optional
from cpl_core.configuration import ConfigurationModelABC
from cpl_core.database import TableABC
@ -27,7 +28,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
help_voice_channel_id: int,
team_channel_id: int,
login_message_channel_id: int,
default_role_id: int,
default_role_id: Optional[int],
feature_flags: dict[FeatureFlagsEnum],
server: Server,
afk_channel_ids: List[int],
@ -76,7 +77,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
guild.system_channel.id,
guild.system_channel.id,
guild.system_channel.id,
guild.default_role.id,
None,
{},
server,
List(int),
@ -288,7 +289,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
{self._help_voice_channel_id},
{self._team_channel_id},
{self._login_message_channel_id},
{self._default_role_id},
{"NULL" if self._default_role_id is None else self._default_role_id},
'{json.dumps(self._feature_flags)}',
{self._server.id}
);
@ -313,7 +314,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`HelpVoiceChannelId` = {self._help_voice_channel_id},
`TeamChannelId` = {self._team_channel_id},
`LoginMessageChannelId` = {self._login_message_channel_id},
`DefaultRoleId` = {self._default_role_id},
`DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id},
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
`ServerId` = {self._server.id}
WHERE `Id` = {self._id};