@@ -35,9 +35,9 @@ async def on_submit(self, interaction: discord.Interaction):
3535 try :
3636 # Validate the prompt
3737 validate_prompt (self .edit_prompt .value )
38-
38+
3939 await interaction .response .defer (thinking = True )
40-
40+
4141 start = datetime .datetime .now ()
4242 discord_logger .log_image_generation (
4343 action = "edit_start" ,
@@ -52,9 +52,9 @@ async def on_submit(self, interaction: discord.Interaction):
5252 dic , edited_image = await generate_cross_pollinate (
5353 prompt = self .edit_prompt .value ,
5454 image_url = self .original_image_url ,
55- nologo = config .image_generation .defaults .nologo
55+ nologo = config .image_generation .defaults .nologo ,
5656 )
57-
57+
5858 time_taken = (datetime .datetime .now () - start ).total_seconds ()
5959 discord_logger .log_image_generation (
6060 action = "edit_complete" ,
@@ -72,7 +72,13 @@ async def on_submit(self, interaction: discord.Interaction):
7272
7373 time_taken_delta = datetime .datetime .now () - start
7474 embed = await generate_cross_pollinate_embed (
75- interaction , False , dic , time_taken_delta , self .edit_prompt .value , self .original_image_url , image_file .filename
75+ interaction ,
76+ False ,
77+ dic ,
78+ time_taken_delta ,
79+ self .edit_prompt .value ,
80+ self .original_image_url ,
81+ image_file .filename ,
7682 )
7783
7884 # Send the edited image with cross-pollinate buttons
@@ -153,7 +159,10 @@ async def edit(self, interaction: discord.Interaction, button: discord.ui.Button
153159 return
154160
155161 # Get the original image URL from the message embed
156- if not interaction .message .embeds or not interaction .message .embeds [0 ].image :
162+ if (
163+ not interaction .message .embeds
164+ or not interaction .message .embeds [0 ].image
165+ ):
157166 await interaction .response .send_message (
158167 embed = SafeEmbed (
159168 title = "🎨 No Image Found" ,
@@ -163,27 +172,27 @@ async def edit(self, interaction: discord.Interaction, button: discord.ui.Button
163172 ephemeral = True ,
164173 )
165174 return
166-
175+
167176 original_image_url = interaction .message .embeds [0 ].image .url
168-
177+
169178 # Get the original prompt based on the embed fields
170179 interaction_data : dict = interaction .message .embeds [0 ].to_dict ()
171-
180+
172181 # Check if it's a cross-pollinate embed or regular pollinate embed
173182 prompt_field = None
174183 for field in interaction_data .get ("fields" , []):
175184 if field ["name" ] in ["Cross-Pollinate Prompt 🐝" , "Prompt" ]:
176185 prompt_field = field
177186 break
178-
187+
179188 original_prompt : str = (
180189 prompt_field ["value" ][3 :- 3 ] if prompt_field else "Unknown prompt"
181190 )
182-
191+
183192 # Show the edit modal
184193 modal = EditImageModal (original_image_url , original_prompt )
185194 await interaction .response .send_modal (modal )
186-
195+
187196 except Exception as e :
188197 discord_logger .log_error (
189198 error_type = "edit_button_error" ,
@@ -552,7 +561,13 @@ async def cross_pollinate_command(
552561
553562 time_taken_delta : datetime .timedelta = datetime .datetime .now () - start
554563 embed : SafeEmbed = await generate_cross_pollinate_embed (
555- interaction , private , dic , time_taken_delta , prompt , image_url , image_file .filename
564+ interaction ,
565+ private ,
566+ dic ,
567+ time_taken_delta ,
568+ prompt ,
569+ image_url ,
570+ image_file .filename ,
556571 )
557572
558573 if private :
0 commit comments