From c9670473daa7b60ad09d0214fc11b6f4ae323699 Mon Sep 17 00:00:00 2001 From: wirehack7 Date: Thu, 1 May 2025 13:35:23 +0200 Subject: [PATCH] added maximum chars --- src/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.py b/src/main.py index 294bbb1..3fd9bbd 100644 --- a/src/main.py +++ b/src/main.py @@ -44,6 +44,16 @@ async def generate( ephemeral=True ) return + + MAX_PROMPT_LENGTH = 500 + + if len(prompt) > MAX_PROMPT_LENGTH: + await interaction.followup.send(f"Prompt too long! Maximum {MAX_PROMPT_LENGTH} chars allowed.") + return + + if len(negative) > MAX_PROMPT_LENGTH: + await interaction.followup.send(f"Negative Prompt too long! Maximum {MAX_PROMPT_LENGTH} chars allowed.") + return await interaction.response.defer(thinking=True)