From a79aa4e9a75a9e047cdb71a0cba38f4588507125 Mon Sep 17 00:00:00 2001 From: Polish Hammer Date: Fri, 2 May 2025 20:10:10 +0200 Subject: [PATCH] fix --- file_search_commands.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/file_search_commands.py b/file_search_commands.py index 0f09bc7..7e76b0c 100644 --- a/file_search_commands.py +++ b/file_search_commands.py @@ -6,7 +6,6 @@ import file_search_functions class FileSelectView(discord.ui.View): def __init__(self, files): super().__init__(timeout=60) - # Create select options for each file options = [discord.SelectOption(label=os.path.basename(f)[:100], description=f, value=f) for f in files] self.select = discord.ui.Select( placeholder="Select files...", @@ -24,7 +23,7 @@ class FileSelectView(discord.ui.View): await interaction.response.defer() @discord.ui.button(label="Accept", style=discord.ButtonStyle.green) - async def accept_callback(self, button: discord.ui.Button, interaction: discord.Interaction): + async def accept_callback(self, interaction: discord.Interaction, button: discord.ui.Button): # Handle acceptance if not self.selected: await interaction.response.send_message("No files selected.", ephemeral=True) @@ -35,7 +34,7 @@ class FileSelectView(discord.ui.View): await interaction.response.edit_message(content="Published Links:\n" + "\n".join(links), view=None) @discord.ui.button(label="Cancel", style=discord.ButtonStyle.red) - async def cancel_callback(self, button: discord.ui.Button, interaction: discord.Interaction): + async def cancel_callback(self, interaction: discord.Interaction, button: discord.ui.Button): # Handle cancellation await interaction.response.edit_message(content="Operation cancelled.", view=None) @@ -52,18 +51,14 @@ class FileSearchCog(commands.Cog): Usage: !findfiles """ - # Validate entries if entries < 1 or entries > 10: await ctx.send("❌ Entries must be between 1 and 10.") return - # Parse keywords keyword_list = keywords.split() - # Find matching files files = file_search_functions.find_matches(entries, keyword_list) if not files: await ctx.send("🔍 No matching files found.") return - # Send a message with a selection UI view = FileSelectView(files) file_list = "\n".join(f"{i+1}. {f}" for i, f in enumerate(files)) await ctx.send( @@ -72,5 +67,4 @@ class FileSearchCog(commands.Cog): ) async def setup(bot: commands.Bot): - """Load the FileSearchCog.""" await bot.add_cog(FileSearchCog(bot))