mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 02:41:06 -05:00
fix(config): add fallback to absolute imports in channel_manager.py
This commit is contained in:
@@ -4,10 +4,18 @@ import logging
|
|||||||
from typing import Dict, List, Optional, Tuple
|
from typing import Dict, List, Optional, Tuple
|
||||||
import discord # type: ignore
|
import discord # type: ignore
|
||||||
|
|
||||||
from .exceptions import (
|
try:
|
||||||
|
# Try relative imports first
|
||||||
|
from .exceptions import (
|
||||||
ConfigurationError as ConfigError,
|
ConfigurationError as ConfigError,
|
||||||
DiscordAPIError,
|
DiscordAPIError,
|
||||||
)
|
)
|
||||||
|
except ImportError:
|
||||||
|
# Fall back to absolute imports if relative imports fail
|
||||||
|
from videoarchiver.config.exceptions import (
|
||||||
|
ConfigurationError as ConfigError,
|
||||||
|
DiscordAPIError,
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger("ChannelManager")
|
logger = logging.getLogger("ChannelManager")
|
||||||
|
|
||||||
@@ -49,8 +57,6 @@ class ChannelManager:
|
|||||||
logger.warning(f"Channel {channel_id} not found in guild {guild.id}")
|
logger.warning(f"Channel {channel_id} not found in guild {guild.id}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
if not isinstance(channel, discord.TextChannel):
|
if not isinstance(channel, discord.TextChannel):
|
||||||
raise DiscordAPIError(f"Channel {channel_id} is not a text channel")
|
raise DiscordAPIError(f"Channel {channel_id} is not a text channel")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user