Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,26 @@ public void onMessageReceived(MessageReceivedEvent event) {
}

private static void createThread(Message message) {
String title = message.getContentRaw();

if (title.length() >= TITLE_MAX_LENGTH) {
int lastWordEnd = title.lastIndexOf(' ', TITLE_MAX_LENGTH);
String threadTitle;
String messageContent = message.getContentRaw();
Comment thread
christolis marked this conversation as resolved.
Outdated

if (messageContent.isEmpty()) {
threadTitle = message.getAuthor().getName();
Comment thread
Zabuzard marked this conversation as resolved.
Outdated
} else if (messageContent.length() >= TITLE_MAX_LENGTH) {
int lastWordEnd = messageContent.lastIndexOf(' ', TITLE_MAX_LENGTH);

if (lastWordEnd == -1) {
lastWordEnd = TITLE_MAX_LENGTH;
}

title = title.substring(0, lastWordEnd);
threadTitle = messageContent.substring(0, lastWordEnd);
} else {

threadTitle = messageContent;
}
Comment thread
Zabuzard marked this conversation as resolved.
Outdated

message.createThreadChannel(title).queue();
message.createThreadChannel(threadTitle).queue();
}

private static void reactWith(String emojiName, Emoji fallbackEmoji, Guild guild,
Expand Down
Loading