Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sendLongMessage function to telegram.js #1052

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shahabhm
Copy link

  • All tests pass
  • I have run npm run doc

Description

I have added a method to handle sending long messages. this method splits the text into smaller parts and sends them. I also can add a test if you agree with this idea.

References

this resolves the following issue:
Sending long messages

@kamikazechaser
Copy link
Collaborator

Well tbh, such a feature alongside #997 should not live in this library. It could either be a util or live outside the library.

One reason is that a quick fire of very long messages e,g, 50k characters+ can easily lead to 429's which can break the correct sequence.

@shahabhm
Copy link
Author

that's right. do you think adding a limit to the text size is enough? like 8k or 12k characters?

@ArtToledo
Copy link

any solution about this? I have the same problem

@ArtToledo
Copy link

image image

I found an error in the implementation when using Math.Max, considering text.length as the second value, so the first time you run chunck, the idea is to cut the message into 4000 characters, with math.max in messages above this an X value, in my case 7741 characters, it gets the wrong chunck_end considering the total size of the message instead of considering where it should break the string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants