@botmesh/core - v2.0.0-alpha.2
    Preparing search index...

    Function splitMessage

    • Split text into parts that fit limit: a max length in UTF-16 code units, or SplitTextOptions with maxLength, maxBytes (UTF-8) and the markup format. Cuts land on natural boundaries (paragraph, line, sentence, word), never inside a grapheme or a markup entity; a fenced block, inline code, emphasis run or HTML element longer than the limit is closed and reopened across parts. Whitespace at a cut is dropped (the indentation of the next line is kept); whitespace-only parts are dropped. Run time is linear in the length of text (its markup is scanned once).

      Parameters

      Returns string[]

      for (const part of splitMessage(longText, { maxLength: 4096, format: ctx.textFormat })) {
      await ctx.reply(part)
      }