Renamed to DakinySettings. Converted dataclass to YAMLWizard.
build_develop / build (push) Failing after 17s
build_develop / build (push) Failing after 17s
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
"""File contains classes defining Dakiny settings structure."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from dataclass_wizard import YAMLWizard
|
||||
|
||||
CONFIG_LOCATION = "conf/config.yaml"
|
||||
|
||||
|
||||
@dataclass
|
||||
class Settings:
|
||||
"""Class defines settings editable by Clan Council."""
|
||||
|
||||
admin_channel_id: int # might want to rename this...
|
||||
announcement_category_id: int
|
||||
clan_council_elect_role_id: int
|
||||
clan_council_role_id: int
|
||||
clan_info_channel_id: int
|
||||
clan_member_role_id: 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
|
||||
class Election:
|
||||
"""Class defines relevant election dates."""
|
||||
|
||||
name: str
|
||||
election_start: str
|
||||
highcouncil_election_announce: str
|
||||
highcouncil_election_end: str
|
||||
highcouncil_election_start: str
|
||||
term_end: str
|
||||
term_start: str
|
||||
voting_end: str
|
||||
voting_start: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class DakinySettings(YAMLWizard):
|
||||
"""Class defines all configs required for Dakiny Bot."""
|
||||
|
||||
election_cycles: list[Election]
|
||||
params: Params
|
||||
settings: Settings
|
||||
|
||||
def save(self) -> None:
|
||||
"""Saves settings to the yaml file."""
|
||||
self.to_yaml_file(CONFIG_LOCATION)
|
||||
|
||||
|
||||
settings = DakinySettings.from_yaml_file(CONFIG_LOCATION)
|
||||
Reference in New Issue
Block a user