asd
This commit is contained in:
parent
f0a24e9d7f
commit
1c1b61c4a8
@ -276,7 +276,7 @@ async def send_discord_message_via_api(channel_id: int, content: str, timeout: f
|
|||||||
|
|
||||||
# Import dependencies after defining settings and constants
|
# Import dependencies after defining settings and constants
|
||||||
# Use absolute imports to avoid issues when running the server directly
|
# Use absolute imports to avoid issues when running the server directly
|
||||||
from discordbot.api_service import dependencies
|
from discordbot.api_service import dependencies # type: ignore
|
||||||
from api_models import (
|
from api_models import (
|
||||||
Conversation,
|
Conversation,
|
||||||
UserSettings,
|
UserSettings,
|
||||||
@ -293,7 +293,7 @@ if discordbot_path not in sys.path:
|
|||||||
sys.path.insert(0, discordbot_path)
|
sys.path.insert(0, discordbot_path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from discordbot import settings_manager
|
from discordbot import settings_manager # type: ignore # type: ignore
|
||||||
from global_bot_accessor import get_bot_instance
|
from global_bot_accessor import get_bot_instance
|
||||||
log.info("Successfully imported settings_manager module and get_bot_instance")
|
log.info("Successfully imported settings_manager module and get_bot_instance")
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
@ -461,7 +461,7 @@ dashboard_api_app = FastAPI(
|
|||||||
# Import dashboard API endpoints
|
# Import dashboard API endpoints
|
||||||
try:
|
try:
|
||||||
# Use absolute import
|
# Use absolute import
|
||||||
from discordbot.api_service.dashboard_api_endpoints import router as dashboard_router
|
from discordbot.api_service.dashboard_api_endpoints import router as dashboard_router # type: ignore
|
||||||
# Add the dashboard router to the dashboard API app
|
# Add the dashboard router to the dashboard API app
|
||||||
dashboard_api_app.include_router(dashboard_router)
|
dashboard_api_app.include_router(dashboard_router)
|
||||||
log.info("Dashboard API endpoints loaded successfully")
|
log.info("Dashboard API endpoints loaded successfully")
|
||||||
@ -476,7 +476,7 @@ except ImportError as e:
|
|||||||
# Import command customization models and endpoints
|
# Import command customization models and endpoints
|
||||||
try:
|
try:
|
||||||
# Use absolute import
|
# Use absolute import
|
||||||
from discordbot.api_service.command_customization_endpoints import router as customization_router
|
from discordbot.api_service.command_customization_endpoints import router as customization_router # type: ignore
|
||||||
# Add the command customization router to the dashboard API app
|
# Add the command customization router to the dashboard API app
|
||||||
dashboard_api_app.include_router(customization_router, prefix="/commands", tags=["Command Customization"])
|
dashboard_api_app.include_router(customization_router, prefix="/commands", tags=["Command Customization"])
|
||||||
log.info("Command customization endpoints loaded successfully")
|
log.info("Command customization endpoints loaded successfully")
|
||||||
@ -487,7 +487,7 @@ except ImportError as e:
|
|||||||
# Import cog management endpoints
|
# Import cog management endpoints
|
||||||
try:
|
try:
|
||||||
# Use absolute import
|
# Use absolute import
|
||||||
from discordbot.api_service.cog_management_endpoints import router as cog_management_router
|
from discordbot.api_service.cog_management_endpoints import router as cog_management_router # type: ignore
|
||||||
log.info("Successfully imported cog_management_endpoints")
|
log.info("Successfully imported cog_management_endpoints")
|
||||||
# Add the cog management router to the dashboard API app
|
# Add the cog management router to the dashboard API app
|
||||||
dashboard_api_app.include_router(cog_management_router, tags=["Cog Management"])
|
dashboard_api_app.include_router(cog_management_router, tags=["Cog Management"])
|
||||||
@ -642,7 +642,7 @@ async def get_guild_cogs_no_deps(guild_id: int):
|
|||||||
# First try to get cogs from the bot instance
|
# First try to get cogs from the bot instance
|
||||||
bot = None
|
bot = None
|
||||||
try:
|
try:
|
||||||
from discordbot import discord_bot_sync_api
|
from discordbot import discord_bot_sync_api # type: ignore
|
||||||
bot = discord_bot_sync_api.bot_instance
|
bot = discord_bot_sync_api.bot_instance
|
||||||
except (ImportError, AttributeError) as e:
|
except (ImportError, AttributeError) as e:
|
||||||
log.warning(f"Could not import bot instance: {e}")
|
log.warning(f"Could not import bot instance: {e}")
|
||||||
@ -883,7 +883,7 @@ async def auth(code: str, state: str = None, code_verifier: str = None, request:
|
|||||||
# Models are now in dashboard_models.py
|
# Models are now in dashboard_models.py
|
||||||
# Dependencies are now in dependencies.py
|
# Dependencies are now in dependencies.py
|
||||||
|
|
||||||
from discordbot.api_service.dashboard_models import (
|
from discordbot.api_service.dashboard_models import ( # type: ignore
|
||||||
GuildSettingsResponse,
|
GuildSettingsResponse,
|
||||||
GuildSettingsUpdate,
|
GuildSettingsUpdate,
|
||||||
CommandPermission,
|
CommandPermission,
|
||||||
@ -1009,7 +1009,7 @@ async def get_guild_cogs_direct(
|
|||||||
# First try to get cogs from the bot instance
|
# First try to get cogs from the bot instance
|
||||||
bot = None
|
bot = None
|
||||||
try:
|
try:
|
||||||
from discordbot import discord_bot_sync_api
|
from discordbot import discord_bot_sync_api # type: ignore
|
||||||
bot = discord_bot_sync_api.bot_instance
|
bot = discord_bot_sync_api.bot_instance
|
||||||
except (ImportError, AttributeError) as e:
|
except (ImportError, AttributeError) as e:
|
||||||
log.warning(f"Could not import bot instance: {e}")
|
log.warning(f"Could not import bot instance: {e}")
|
||||||
@ -1177,7 +1177,7 @@ async def update_cog_status_direct(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Get the bot instance to check if pools are available
|
# Get the bot instance to check if pools are available
|
||||||
from discordbot.global_bot_accessor import get_bot_instance
|
from discordbot.global_bot_accessor import get_bot_instance # type: ignore
|
||||||
bot_instance = get_bot_instance()
|
bot_instance = get_bot_instance()
|
||||||
if not bot_instance or not bot_instance.pg_pool:
|
if not bot_instance or not bot_instance.pg_pool:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@ -1188,7 +1188,7 @@ async def update_cog_status_direct(
|
|||||||
# Try to get the bot instance, but don't require it
|
# Try to get the bot instance, but don't require it
|
||||||
bot = None
|
bot = None
|
||||||
try:
|
try:
|
||||||
from discordbot import discord_bot_sync_api
|
from discordbot import discord_bot_sync_api # type: ignore # type: ignore
|
||||||
bot = discord_bot_sync_api.bot_instance
|
bot = discord_bot_sync_api.bot_instance
|
||||||
except (ImportError, AttributeError) as e:
|
except (ImportError, AttributeError) as e:
|
||||||
log.warning(f"Could not import bot instance: {e}")
|
log.warning(f"Could not import bot instance: {e}")
|
||||||
@ -1251,7 +1251,7 @@ async def update_command_status_direct(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Get the bot instance to check if pools are available
|
# Get the bot instance to check if pools are available
|
||||||
from discordbot.global_bot_accessor import get_bot_instance
|
from discordbot.global_bot_accessor import get_bot_instance # type: ignore
|
||||||
bot_instance = get_bot_instance()
|
bot_instance = get_bot_instance()
|
||||||
if not bot_instance or not bot_instance.pg_pool:
|
if not bot_instance or not bot_instance.pg_pool:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@ -1262,7 +1262,7 @@ async def update_command_status_direct(
|
|||||||
# Try to get the bot instance, but don't require it
|
# Try to get the bot instance, but don't require it
|
||||||
bot = None
|
bot = None
|
||||||
try:
|
try:
|
||||||
from discordbot import discord_bot_sync_api
|
from discordbot import discord_bot_sync_api # type: ignore
|
||||||
bot = discord_bot_sync_api.bot_instance
|
bot = discord_bot_sync_api.bot_instance
|
||||||
except (ImportError, AttributeError) as e:
|
except (ImportError, AttributeError) as e:
|
||||||
log.warning(f"Could not import bot instance: {e}")
|
log.warning(f"Could not import bot instance: {e}")
|
||||||
@ -2202,7 +2202,7 @@ async def ai_moderation_action(
|
|||||||
|
|
||||||
# Add to moderation log
|
# Add to moderation log
|
||||||
try:
|
try:
|
||||||
from discordbot.db import mod_log_db
|
from discordbot.db import mod_log_db # type: ignore
|
||||||
bot = get_bot_instance()
|
bot = get_bot_instance()
|
||||||
|
|
||||||
# Create AI details dictionary with all relevant information
|
# Create AI details dictionary with all relevant information
|
||||||
|
@ -275,7 +275,7 @@ class GitMonitorCog(commands.Cog):
|
|||||||
# The API server needs the bot's domain. This should be configured.
|
# The API server needs the bot's domain. This should be configured.
|
||||||
# For now, we'll use a placeholder.
|
# For now, we'll use a placeholder.
|
||||||
# TODO: Fetch API base URL from config or bot instance
|
# TODO: Fetch API base URL from config or bot instance
|
||||||
api_base_url = getattr(self.bot, 'config', {}).get('API_BASE_URL', 'slipstreamm.dev/api')
|
api_base_url = getattr(self.bot, 'config', {}).get('API_BASE_URL', 'slipstreamm.dev')
|
||||||
if api_base_url == 'YOUR_API_DOMAIN_HERE.com':
|
if api_base_url == 'YOUR_API_DOMAIN_HERE.com':
|
||||||
log.warning("API_BASE_URL not configured for webhook URL generation. Using placeholder.")
|
log.warning("API_BASE_URL not configured for webhook URL generation. Using placeholder.")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user