Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit 362a64c

Browse files
committed
Refactor: Add comments to embed = discord.Embed()
1 parent c21ecb3 commit 362a64c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • projects/Chat-GPT-Discord-Bot

projects/Chat-GPT-Discord-Bot/main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
load_dotenv(override=True)
1010

1111
with open("projects/Chat-GPT-Discord-Bot/GPT_Parameters.json") as f:
12-
data = json.load(f)
12+
data = json.load(f) # Loads the gpt system prompts
1313

14-
char_limit = data["system_content"][0]["character_limit_prompt"]
14+
char_limit = data["system_content"][0]["character_limit_prompt"] # Makes sure that the gpt output wont exceed the discord embed character limit of 4096 characters
1515

1616
try:
1717
token = os.getenv("BOT_TOKEN") # returns a str
@@ -198,6 +198,7 @@ async def send(interaction: discord.Interaction, text: str): # noqa: F811
198198
ephemeral=False
199199
) # Defer the response to prevent command timeout
200200

201+
# It is best to use discord embeds for gpt commands as discord embed descriptions allow for 4096 characters instead of 2000 characters for normal messages
201202
embed = discord.Embed(
202203
title="Correct Grammar",
203204
description=gpt(
@@ -237,6 +238,7 @@ async def send(interaction: discord.Interaction, text: str): # noqa: F811
237238
ephemeral=False
238239
) # Defer the response to prevent command timeout
239240

241+
# It is best to use discord embeds for gpt commands as discord embed descriptions allow for 4096 characters instead of 2000 characters for normal messages
240242
embed = discord.Embed(
241243
title="Single Page Website",
242244
description=gpt(
@@ -281,6 +283,7 @@ async def send(interaction: discord.Interaction, text: str): # noqa: F811
281283
else:
282284
gpt_prompt = text
283285

286+
# It is best to use discord embeds for gpt commands as discord embed descriptions allow for 4096 characters instead of 2000 characters for normal messages
284287
embed = discord.Embed(
285288
title=f'Text to Emoji - "{text}"',
286289
description=gpt(
@@ -319,6 +322,7 @@ async def send(interaction: discord.Interaction, text: str): # noqa: F811
319322
ephemeral=False
320323
) # Defer the response to prevent command timeout
321324

325+
# It is best to use discord embeds for gpt commands as discord embed descriptions allow for 4096 characters instead of 2000 characters for normal messages
322326
embed = discord.Embed(
323327
title="Text to block letter emojis",
324328
description=gpt(
@@ -355,6 +359,7 @@ async def send(interaction: discord.Interaction, text: str): # noqa: F811
355359
ephemeral=False
356360
) # Defer the response to prevent command timeout
357361

362+
# It is best to use discord embeds for gpt commands as discord embed descriptions allow for 4096 characters instead of 2000 characters for normal messages
358363
embed = discord.Embed(
359364
title="Code Debug",
360365
description=gpt(
@@ -393,6 +398,7 @@ async def send(interaction: discord.Interaction, text: str): # noqa: F811
393398
ephemeral=False
394399
) # Defer the response to prevent command timeout
395400

401+
# It is best to use discord embeds for gpt commands as discord embed descriptions allow for 4096 characters instead of 2000 characters for normal messages
396402
embed = discord.Embed(
397403
title="Short Story",
398404
description=gpt(
@@ -437,6 +443,7 @@ async def send(interaction: discord.Interaction, text: str): # noqa: F811
437443
else:
438444
gpt_prompt = text
439445

446+
# It is best to use discord embeds for gpt commands as discord embed descriptions allow for 4096 characters instead of 2000 characters for normal messages
440447
embed = discord.Embed(
441448
title=f'General Question - "{text}"',
442449
description=gpt(

0 commit comments

Comments
 (0)