noobami
noobami

Reputation: 39

Send whole content of .txt (500+lines) in discord chat? javascript/discordbot

I want to show the whole content of a txt with 500+ lines on discord chat but discord has a limit of characters per message - must be fewer than 2000 in length.

I was only able to show the first 175 lines using the code bellow. I used split[separator][limit]. How can I send the rest of the file content in the chat?

 if (message.content === '!list') {
   var text = fs.readFileSync('list.txt', 'utf8');
    let vvv = text.split(',',175);
     message.channel.send(text);

Upvotes: 0

Views: 619

Answers (1)

user15517071
user15517071

Reputation: 614

Using the split parameter on MessageOptions passed to TextChannel.send() you can split messages and specify the maximum length if you wish.

Upvotes: 1

Related Questions