senderbot/modules/configuration.py
2024-06-08 17:56:40 +03:00

21 lines
478 B
Python

"""Module for work with config-file."""
from pathlib import Path
import yaml
class Configuration:
"""Class for parsing config-file."""
def __init__(self, path: str) -> None:
"""Init class."""
self.path = path
self.config = self.get()
self.token = self.config["telegram_token"]
def get(self) -> dict:
"""Open file and get all value."""
with Path(self.path).open() as file:
return yaml.safe_load(file)