First working version of jellyseerr discord bot
This commit is contained in:
42
config.py
Normal file
42
config.py
Normal file
@ -0,0 +1,42 @@
|
||||
import os
|
||||
import logging
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load environment variables from .env file
|
||||
load_dotenv()
|
||||
|
||||
# Debug mode
|
||||
DEBUG_MODE = os.getenv('DEBUG_MODE', 'false').lower() == 'true'
|
||||
LOG_LEVEL = logging.DEBUG if DEBUG_MODE else logging.INFO
|
||||
|
||||
# Bot configuration
|
||||
BOT_TOKEN = os.getenv('DISCORD_BOT_TOKEN')
|
||||
BOT_PREFIX = os.getenv('BOT_PREFIX', '!') # Default prefix is ! if not specified
|
||||
|
||||
# Jellyseerr configuration
|
||||
JELLYSEERR_URL = os.getenv('JELLYSEERR_URL')
|
||||
JELLYSEERR_EMAIL = os.getenv('JELLYSEERR_EMAIL')
|
||||
JELLYSEERR_PASSWORD = os.getenv('JELLYSEERR_PASSWORD')
|
||||
JELLYSEERR_LOCAL_LOGIN = os.getenv('JELLYSEERR_LOCAL_LOGIN', 'true').lower() == 'true'
|
||||
|
||||
# Bot settings
|
||||
EMBED_COLOR = int(os.getenv('EMBED_COLOR', '0x3498db'), 0) # Default color is blue
|
||||
|
||||
# Authentication settings
|
||||
AUTH_COOKIE_EXPIRY = int(os.getenv('AUTH_COOKIE_EXPIRY', '7')) # Days until cookie expires
|
||||
|
||||
# Notification settings are not used as Jellyseerr webhooks are preferred
|
||||
# You can configure webhooks directly in Jellyseerr's settings
|
||||
|
||||
# Debug settings
|
||||
REQUEST_TIMEOUT = int(os.getenv('REQUEST_TIMEOUT', '30')) # Seconds to wait for API response
|
||||
|
||||
# Validation
|
||||
if not BOT_TOKEN:
|
||||
raise ValueError("No Discord bot token found. Please set DISCORD_BOT_TOKEN in your .env file.")
|
||||
|
||||
if not JELLYSEERR_URL:
|
||||
raise ValueError("No Jellyseerr URL found. Please set JELLYSEERR_URL in your .env file.")
|
||||
|
||||
if JELLYSEERR_LOCAL_LOGIN and (not JELLYSEERR_EMAIL or not JELLYSEERR_PASSWORD):
|
||||
raise ValueError("Jellyseerr email and password are required for local login. Please set JELLYSEERR_EMAIL and JELLYSEERR_PASSWORD in your .env file.")
|
Reference in New Issue
Block a user