123
This commit is contained in:
parent
82dd6070ad
commit
6dfa3a28da
@ -17,9 +17,21 @@ import abc # For Abstract Base Class
|
||||
# Setup logger for this cog
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class GelbooruWatcherBaseCog(commands.Cog, abc.ABC):
|
||||
# Combined metaclass to resolve conflicts between CogMeta and ABCMeta
|
||||
class GelbooruWatcherMeta(commands.CogMeta, abc.ABCMeta):
|
||||
pass
|
||||
|
||||
class GelbooruWatcherBaseCog(commands.Cog, abc.ABC, metaclass=GelbooruWatcherMeta):
|
||||
def __init__(self, bot: commands.Bot, cog_name: str, api_base_url: str, default_tags: str, is_nsfw_site: bool, command_group_name: str, main_command_name: str):
|
||||
self.bot = bot
|
||||
# Ensure super().__init__() is called for Cog's metaclass features, especially if 'name' was passed to Cog.
|
||||
# However, 'name' is handled by the derived classes (Rule34Cog, SafebooruCog)
|
||||
# For the base class, we don't pass 'name' to commands.Cog constructor directly.
|
||||
# The `name` parameter in `Rule34Cog(..., name="Rule34")` is handled by CogMeta.
|
||||
# The base class itself doesn't need a Cog 'name' in the same way.
|
||||
# commands.Cog.__init__(self, bot) # This might be needed if Cog's __init__ does setup
|
||||
# Let's rely on the derived class's super() call to handle Cog's __init__ properly.
|
||||
|
||||
self.cog_name = cog_name
|
||||
self.api_base_url = api_base_url
|
||||
self.default_tags = default_tags
|
||||
|
@ -9,7 +9,7 @@ from .gelbooru_watcher_base_cog import GelbooruWatcherBaseCog
|
||||
# Setup logger for this cog
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class Rule34Cog(GelbooruWatcherBaseCog, name="Rule34"):
|
||||
class Rule34Cog(GelbooruWatcherBaseCog): # Removed name="Rule34"
|
||||
# Define the command group specific to this cog
|
||||
r34watch = app_commands.Group(name="r34watch", description="Manage Rule34 tag watchers for new posts.")
|
||||
|
||||
|
@ -9,7 +9,7 @@ from .gelbooru_watcher_base_cog import GelbooruWatcherBaseCog
|
||||
# Setup logger for this cog
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class SafebooruCog(GelbooruWatcherBaseCog, name="Safebooru"):
|
||||
class SafebooruCog(GelbooruWatcherBaseCog): # Removed name="Safebooru"
|
||||
# Define the command group specific to this cog
|
||||
safebooruwatch = app_commands.Group(name="safebooruwatch", description="Manage Safebooru tag watchers for new posts.")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user