0

I have a large string I would like to send:

my_text = "...greater.than.4096.chars..."
embed = discord.Embed(title='Hello World')
embed.description = my_text
await ctx.send(embed=embed)

However I get this error: In embed.description: Must be 4096 or fewer in length.

Is there a way in discord.py to automatically split the string into multiple chunks to be sent?

In discord.js, they have a way to do so like this:

.send(data, { split: true })

Is there something similar for discord.py? Or do I have to write my own solution?

doejoe
  • 125
  • 2
  • 8

1 Answers1

0

Theres no built in way as far as I know in discord.py. But you can of course split it manually. Something like this should work?

from math import ceil

for i in range(ceil(len(my_text) / 4096)):
    embed = discord.Embed(title='Hello World')
    embed.description = (my_text[(4096*i):(4096*(i+1))])
    await ctx.send(embed=embed)
moinierer3000
  • 1,927
  • 2
  • 9
  • 24