Archived
generated from imcompiling/discord-bot-template
38 lines
755 B
Python
38 lines
755 B
Python
"""File contains classes defining off-cooldown-bot settings structure."""
|
|
|
|
from dataclasses import dataclass
|
|
|
|
from dataclass_wizard import YAMLWizard
|
|
|
|
CONFIG_LOCATION = "conf/config.yaml"
|
|
|
|
|
|
@dataclass
|
|
class ChannelIds:
|
|
"""Class holds all channel ids needed by bot."""
|
|
|
|
general: int
|
|
|
|
|
|
@dataclass
|
|
class Params:
|
|
"""Class defines start parameters that shouldn't be changed."""
|
|
|
|
discord_token: str
|
|
guild_id: int
|
|
|
|
|
|
@dataclass
|
|
class Settings(YAMLWizard):
|
|
"""Class defines all configs required for off-cooldown-bot."""
|
|
|
|
channel_ids: ChannelIds
|
|
params: Params
|
|
|
|
def save(self) -> None:
|
|
"""Save settings to the yaml file."""
|
|
self.to_yaml_file(CONFIG_LOCATION)
|
|
|
|
|
|
settings = Settings.from_yaml_file(CONFIG_LOCATION)
|