discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.36k stars 3.97k forks source link

MessageOptions「split」not working #5938

Closed waki285 closed 3 years ago

waki285 commented 3 years ago

I used the split option because I wanted to post a sentence longer than 2000 characters. But it doesn't work due to an error.

Code:

const text = "(Sentence of 2000 characters or more)"

client.on('message', async message => {
  if (message.content === "!sentence") {
    message.channel.send(text, { split: true});
  }
});

Error:

DiscordAPIError:Cannot send an empty message

Further details:

Relevant client options:

monbrey commented 3 years ago

The split option has been removed from v13, and v12 won't be getting any patches.

NokiD3V commented 3 years ago

What do this function ?

kyranet commented 3 years ago

Please, see #5918 for the change in v13. Since the option's not longer there, it's fixed in master.

As for v12, you need to make sure there are new-lines in your text so it can be split. Please use strings or an array of strings so the utility can split the content correctly.