Split long answers into two mesages
This commit is contained in:
parent
ac3bd0cd74
commit
84aedccc66
@ -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"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user