44 lines
1.3 KiB
Python
Executable File
44 lines
1.3 KiB
Python
Executable File
# discord_tools/config/settings.py
|
|
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
# Load environment variables from .env file
|
|
load_dotenv()
|
|
|
|
# Discord API settings
|
|
DISCORD_API_BASE_URL = "https://discord.com/api/v9"
|
|
DISCORD_TOKEN = os.getenv('DISCORD_TOKEN')
|
|
|
|
# Rate limiting settings
|
|
RATE_LIMIT_ATTEMPTS = 5
|
|
RATE_LIMIT_DELAY = 5 # seconds
|
|
|
|
# Logging settings
|
|
LOG_LEVEL = "INFO"
|
|
LOG_FILE = "discord_tools.log"
|
|
|
|
# File paths
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
DATA_DIR = os.path.join(BASE_DIR, "data")
|
|
|
|
# Ensure data directory exists
|
|
os.makedirs(DATA_DIR, exist_ok=True)
|
|
|
|
# Default values for various tools
|
|
DEFAULT_STATUS_UPDATE_INTERVAL = 60 # seconds
|
|
MAX_MESSAGES_PER_REQUEST = 100
|
|
DEFAULT_AVATAR_SIZE = 128 # pixels
|
|
|
|
# Error messages
|
|
ERROR_MESSAGES = {
|
|
"token_not_found": "Discord token not found. Please set the DISCORD_TOKEN environment variable.",
|
|
"rate_limit_exceeded": "Rate limit exceeded. Please try again later.",
|
|
"api_error": "An error occurred while communicating with the Discord API.",
|
|
"file_not_found": "The specified file was not found.",
|
|
"invalid_input": "Invalid input provided. Please check your input and try again.",
|
|
}
|
|
|
|
# Validate required settings
|
|
if not DISCORD_TOKEN:
|
|
raise ValueError(ERROR_MESSAGES["token_not_found"]) |