Rifat Azad commited on
Commit
03c17c6
·
1 Parent(s): 90597fa

fixed chat reponse over 2k chracters to send half by half

Browse files
Files changed (1) hide show
  1. pydvpl_bot.py +12 -6
pydvpl_bot.py CHANGED
@@ -604,16 +604,14 @@ async def clock(ctx):
604
  # FUNCTION ------------------------------------------------------ SPLIT
605
 
606
 
607
- @bot.hybrid_command(help="Chat with ai llm models like 'phind', 'chatgpt' & 'blackboxai'.")
608
  async def chat(ctx, model, *, message):
609
-
610
  if str(ctx.author.id) not in AUTHORIZED_AI_ACCESS_ID:
611
  await ctx.reply("You are not authorized to use this command. Only `@rifsxd`'s server boosters & special permitted users can enjoy free `ChatGPT` access.")
612
-
613
  return
614
 
615
  msg = await ctx.reply("Responding...")
616
-
617
  if model.lower() == "phind":
618
  bot = phind.PHIND()
619
  elif model.lower() == "chatgpt":
@@ -623,9 +621,17 @@ async def chat(ctx, model, *, message):
623
  else:
624
  await ctx.reply("Invalid model. Please choose 'phind' or 'chatgpt' or 'blackboxai'.")
625
  return
626
-
627
  response = bot.chat(message)
628
- await msg.edit(content=response)
 
 
 
 
 
 
 
 
629
 
630
  #await ctx.reply(f"The command `chat` was executed by - {ctx.author.mention}")
631
 
 
604
  # FUNCTION ------------------------------------------------------ SPLIT
605
 
606
 
607
+ @bot.hybrid_command(help="Chat with AI LLM models like 'phind', 'chatgpt', & 'blackboxai'.")
608
  async def chat(ctx, model, *, message):
 
609
  if str(ctx.author.id) not in AUTHORIZED_AI_ACCESS_ID:
610
  await ctx.reply("You are not authorized to use this command. Only `@rifsxd`'s server boosters & special permitted users can enjoy free `ChatGPT` access.")
 
611
  return
612
 
613
  msg = await ctx.reply("Responding...")
614
+
615
  if model.lower() == "phind":
616
  bot = phind.PHIND()
617
  elif model.lower() == "chatgpt":
 
621
  else:
622
  await ctx.reply("Invalid model. Please choose 'phind' or 'chatgpt' or 'blackboxai'.")
623
  return
624
+
625
  response = bot.chat(message)
626
+ if len(response) > 2000:
627
+ half_length = len(response) // 2
628
+ first_half = response[:half_length]
629
+ second_half = response[half_length:]
630
+ await msg.edit(content=f"{first_half}-")
631
+ await ctx.send(f"-{second_half}")
632
+ else:
633
+ await msg.edit(content=response)
634
+
635
 
636
  #await ctx.reply(f"The command `chat` was executed by - {ctx.author.mention}")
637