Organized settings better within the dataclass.
This commit is contained in:
+41
-26
@@ -8,32 +8,15 @@ CONFIG_LOCATION = "conf/config.yaml"
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Settings:
|
class ChannelIds:
|
||||||
"""Class defines settings editable by Clan Council."""
|
"""Class holds all channel ids needed by bot."""
|
||||||
|
|
||||||
admin_channel_id: int # might want to rename this...
|
admin: int # might want to rename this...
|
||||||
announcement_category_id: int
|
announcement_category: int
|
||||||
clan_council_elect_role_id: int
|
clan_info: int
|
||||||
clan_council_role_id: int
|
event_post: int
|
||||||
clan_info_channel_id: int
|
general: int
|
||||||
clan_member_role_id: int
|
voting_parent: int
|
||||||
event_host_points: int
|
|
||||||
event_host_role_id: int
|
|
||||||
event_participate_points: int
|
|
||||||
event_points_weekly_limit: int
|
|
||||||
event_post_channel_id: int
|
|
||||||
general_channel_id: int
|
|
||||||
high_council_role_id: int
|
|
||||||
voting_parent_id: int
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class Params:
|
|
||||||
"""Class defines start parameters that shouldn't be changed."""
|
|
||||||
|
|
||||||
discord_token: str
|
|
||||||
git_branch: str
|
|
||||||
guild_id: int
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -51,13 +34,44 @@ class Election:
|
|||||||
voting_start: str
|
voting_start: str
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Params:
|
||||||
|
"""Class defines start parameters that shouldn't be changed."""
|
||||||
|
|
||||||
|
discord_token: str
|
||||||
|
git_branch: str
|
||||||
|
guild_id: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class RoleIds:
|
||||||
|
"""Class holds all role ids needed by bot."""
|
||||||
|
|
||||||
|
clan_council_elect: int
|
||||||
|
clan_council: int
|
||||||
|
clan_member: int
|
||||||
|
event_host: int
|
||||||
|
high_council: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class EventSettings:
|
||||||
|
"""Class defines settings editable by Clan Council."""
|
||||||
|
|
||||||
|
host_points: int
|
||||||
|
participate_points: int
|
||||||
|
weekly_limit: int
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class DakinySettings(YAMLWizard):
|
class DakinySettings(YAMLWizard):
|
||||||
"""Class defines all configs required for Dakiny Bot."""
|
"""Class defines all configs required for Dakiny Bot."""
|
||||||
|
|
||||||
|
channel_ids: ChannelIds
|
||||||
election_cycles: list[Election]
|
election_cycles: list[Election]
|
||||||
|
event_settings: EventSettings
|
||||||
params: Params
|
params: Params
|
||||||
settings: Settings
|
role_ids: RoleIds
|
||||||
|
|
||||||
def save(self) -> None:
|
def save(self) -> None:
|
||||||
"""Saves settings to the yaml file."""
|
"""Saves settings to the yaml file."""
|
||||||
@@ -65,3 +79,4 @@ class DakinySettings(YAMLWizard):
|
|||||||
|
|
||||||
|
|
||||||
settings = DakinySettings.from_yaml_file(CONFIG_LOCATION)
|
settings = DakinySettings.from_yaml_file(CONFIG_LOCATION)
|
||||||
|
settings.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user