Split long answers into two mesages

This commit is contained in:
Luke Robles 2024-04-10 20:17:50 -07:00
parent ac3bd0cd74
commit 84aedccc66

View File

@ -213,7 +213,12 @@ async def on_message(ctx):
response = requests.post(url, json=payload, headers=headers)
answer = response.json()["choices"][0]["message"]["content"]
await ctx.reply(answer.replace("<|end_of_turn|>", ""))
if len(answer) > 2000:
await ctx.reply(answer[:2000].replace("<|end_of_turn|>", ""))
await ctx.reply(answer[2000:].replace("<|end_of_turn|>", ""))
else:
await ctx.reply(answer.replace("<|end_of_turn|>", ""))
bot.run(os.getenv("discord_token"))