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

How should I handle replies to messages that are too long? #85

Closed
Arinerron opened this issue Sep 2, 2017 · 2 comments
Closed

How should I handle replies to messages that are too long? #85

Arinerron opened this issue Sep 2, 2017 · 2 comments
Labels
cannot reproduce An issue which cannot be reproduced

Comments

@Arinerron
Copy link

I tried splitting up replies into chunks of 2000 chars (that's the limit for each message), but it didn't work:

(the variable string is the response, by the way)

                            if(string != null) {
                                if(string.length() > 2000) {
                                    // split into chunks of 2000
                                    List<String> strings = new ArrayList<String>();
                                    int index = 0;
                                    int chunks = 2000;
                                    while (index < string.length()) {
                                        strings.add(string.substring(index, Math.min(index + chunks, string.length())));
                                        index += chunks;
                                    }

                                    for(String s : strings) {
                                        message.reply(string); // I know for a fact that `string` is set correctly and that the code to split messages into chunks is working. It is a problem with message.reply(string).
                                    }
                                } else*/
                                    message.reply(string);
                            }

There's no output or exceptions. No messages sent on discord. No nothing. It simply just does not work. I tried putting a Thread.sleep(1000) after the message.reply(string) to see if maybe a delay would work, but nope. I also tried making the message chunks 500 chars long, but that didn't work either. Honestly, I have no idea what to say.

@Arinerron
Copy link
Author

And without the code to split it into chunks, it also produces no output.

@Bastian
Copy link
Member

Bastian commented Sep 5, 2017

Message#reply() returns a future.
Check if message.reply(string).get() throws an exception.

@Bastian Bastian closed this as completed Oct 1, 2017
@Bastian Bastian added the cannot reproduce An issue which cannot be reproduced label Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot reproduce An issue which cannot be reproduced
Projects
None yet
Development

No branches or pull requests

2 participants