This repository has been archived on 2025-04-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
off-cooldown-bot/off_cooldown_bot/settings.py
T
imcompiling 5a8119f5e4
build_develop / build (push) Successful in 22s
Add the daily loop for open raid.
2025-03-19 21:27:58 -04:00

43 lines
871 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
raid: 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)
# I'm not expecting a list to be returned.
if isinstance(settings, list):
settings = settings[0]