Initial commit
This commit is contained in:
22
config.py
Normal file
22
config.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
class Config:
|
||||
DISCORD_TOKEN: str = os.getenv("DISCORD_TOKEN", "")
|
||||
TEXT_CHANNEL_ID: int = int(os.getenv("TEXT_CHANNEL_ID", "0"))
|
||||
VOICE_WAV_PATH: str = os.getenv("VOICE_WAV_PATH", "./voice.wav")
|
||||
|
||||
@classmethod
|
||||
def validate(cls) -> list[str]:
|
||||
"""Validate configuration and return list of errors."""
|
||||
errors = []
|
||||
if not cls.DISCORD_TOKEN:
|
||||
errors.append("DISCORD_TOKEN is not set")
|
||||
if cls.TEXT_CHANNEL_ID == 0:
|
||||
errors.append("TEXT_CHANNEL_ID is not set")
|
||||
if not os.path.exists(cls.VOICE_WAV_PATH):
|
||||
errors.append(f"Voice WAV file not found: {cls.VOICE_WAV_PATH}")
|
||||
return errors
|
||||
Reference in New Issue
Block a user