diff --git a/birthday/birthday.py b/birthday/birthday.py index 7ddd1bb..650f4ee 100644 --- a/birthday/birthday.py +++ b/birthday/birthday.py @@ -112,20 +112,20 @@ class Birthday(commands.Cog): await self.config.guild(ctx.guild).birthday_channel.set(channel.id) await ctx.send(f"Birthday announcement channel set to {channel.mention}") - @commands.hybrid_command(name="addrole") + @commands.hybrid_command(name="birthdayallowrole") @app_commands.guild_only() @app_commands.describe(role="The role to allow using the birthday command") - async def add_allowed_role(self, ctx: commands.Context, role: discord.Role): + async def birthday_allow_role(self, ctx: commands.Context, role: discord.Role): """Add a role that can use the birthday command.""" async with self.config.guild(ctx.guild).allowed_roles() as allowed_roles: if role.id not in allowed_roles: allowed_roles.append(role.id) await ctx.send(f"Added {role.name} to the list of roles that can use the birthday command.") - @commands.hybrid_command(name="removerole") + @commands.hybrid_command(name="birthdayremoverole") @app_commands.guild_only() @app_commands.describe(role="The role to remove from using the birthday command") - async def remove_allowed_role(self, ctx: commands.Context, role: discord.Role): + async def birthday_remove_role(self, ctx: commands.Context, role: discord.Role): """Remove a role from using the birthday command.""" async with self.config.guild(ctx.guild).allowed_roles() as allowed_roles: if role.id in allowed_roles: diff --git a/videoarchiver/processor.py b/videoarchiver/processor.py index 07a0651..8198d20 100644 --- a/videoarchiver/processor.py +++ b/videoarchiver/processor.py @@ -293,7 +293,9 @@ class VideoProcessor: for word in words: # Try each extractor for ie in ydl._ies: - if ie.suitable(word): + # Use suitable as a classmethod and check the result + result = ie.suitable(word) + if result and not isinstance(result, str): urls.append(word) break # Stop once we find a matching extractor except Exception as e: diff --git a/videoarchiver/utils/video_downloader.py b/videoarchiver/utils/video_downloader.py index 9a3ac4c..f77ebdf 100644 --- a/videoarchiver/utils/video_downloader.py +++ b/videoarchiver/utils/video_downloader.py @@ -93,7 +93,7 @@ class VideoDownloader: try: with yt_dlp.YoutubeDL() as ydl: for extractor in ydl._ies: - if hasattr(extractor, "_VALID_URL") and extractor._VALID_URL: + if hasattr(extractor, '_VALID_URL') and extractor._VALID_URL: if not self.enabled_sites or any( site.lower() in extractor.IE_NAME.lower() for site in self.enabled_sites @@ -313,8 +313,8 @@ class VideoDownloader: for site in self.enabled_sites ): continue - # Try to match URL - if extractor.suitable(url): + # Try to match URL using the class method + if extractor.suitable(url) and not isinstance(extractor.suitable(url), str): return True return False except Exception as e: