mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 02:41:06 -05:00
Added proper error handling in enable_database command to handle cases where the setting doesn't exist yet
Fixed redbot import issues by importing specific exception classes Ensured database setting is properly synchronized between base.py and config_manager.py Added proper database initialization and reference handling
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""Configuration management for VideoArchiver"""
|
||||
from redbot.core import Config
|
||||
from redbot.core import commands # Added for exception types
|
||||
from typing import Dict, Any, Optional, List, Union, cast
|
||||
import discord
|
||||
import logging
|
||||
@@ -33,6 +34,7 @@ class ConfigManager:
|
||||
"retry_delay": 5,
|
||||
"discord_retry_attempts": 3,
|
||||
"discord_retry_delay": 5,
|
||||
"use_database": False, # Added the missing use_database setting
|
||||
}
|
||||
|
||||
# Valid settings constraints
|
||||
@@ -88,7 +90,7 @@ class ConfigManager:
|
||||
elif setting in ["message_template"] and not isinstance(value, str):
|
||||
raise ConfigError("Message template must be a string")
|
||||
|
||||
elif setting in ["enabled", "delete_after_repost", "disable_update_check"] and not isinstance(value, bool):
|
||||
elif setting in ["enabled", "delete_after_repost", "disable_update_check", "use_database"] and not isinstance(value, bool):
|
||||
raise ConfigError(f"{setting} must be a boolean")
|
||||
|
||||
except Exception as e:
|
||||
@@ -343,6 +345,11 @@ class ConfigManager:
|
||||
value=str(settings["disable_update_check"]),
|
||||
inline=True
|
||||
)
|
||||
embed.add_field(
|
||||
name="Database Enabled",
|
||||
value=str(settings["use_database"]),
|
||||
inline=True
|
||||
)
|
||||
|
||||
# Add enabled sites with validation
|
||||
embed.add_field(
|
||||
|
||||
Reference in New Issue
Block a user