Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit 51ffcb5

Browse files
committed
feat: exclude non-generated images url
1 parent 5adc1f2 commit 51ffcb5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/image/image_create.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ async def create_image_bing(chatbot, interaction: discord.Interaction, prompt: s
7171

7272
async_gen = ImageGenAsync(auth_cookie=auth_cookie, quiet=True, proxy=os.getenv("PROXY"))
7373
images = await async_gen.get_images(prompt=prompt, timeout=int(os.getenv("IMAGE_TIMEOUT")), max_generate_time_sec=int(os.getenv("IMAGE_MAX_CREATE_SEC")))
74-
images = [file for file in images if not file.endswith('.svg')]
74+
images = [file for file in images if not (file.endswith('.svg') or file.endswith('.js'))]
7575
new_image = await concatenate_images(images)
7676
image_data = BytesIO()
7777
new_image.save(image_data, format='PNG')
7878
image_data.seek(0)
7979

8080
await interaction.followup.send(prompts, file=discord.File(fp=image_data, filename='new_image.png'), view=ButtonView(interaction, prompt, chatbot, images))
8181
except asyncio.TimeoutError:
82-
await interaction.followup.send("> **Error:Request timed out.**")
82+
await interaction.followup.send("> **ERROR:Request timed out.**")
8383
logger.error("Error while create image:Request timed out.")
8484
except TypeError:
85-
await interaction.followup.send("> **Error:No images returned.**")
85+
await interaction.followup.send("> **ERROR:No images returned.**")
8686
logger.error("Error while create image:No images returned.")
8787
except Exception as e:
88-
await interaction.followup.send(f"> **Error{e}**")
88+
await interaction.followup.send(f"> **ERROR{e}**")
8989
logger.error(f"Error while create image:{e}")
9090

9191
async def concatenate_images(image_urls):

0 commit comments

Comments
 (0)