-
-
Notifications
You must be signed in to change notification settings - Fork 89
Auto create threads for suggestions #469
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
Conversation
application/src/main/java/org/togetherjava/tjbot/commands/basic/SuggestionsUpDownVoter.java
Outdated
Show resolved
Hide resolved
what to do about the spotless check? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the code is not passing spotless.
application/src/main/java/org/togetherjava/tjbot/commands/basic/SuggestionsUpDownVoter.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/basic/SuggestionsUpDownVoter.java
Outdated
Show resolved
Hide resolved
If you have set up the code locally and use the gradle commands, it would run spotless already for you. See our wiki for details on that. |
what the thread title should be "Discussion on User's suggestion" or "Discussion for User's suggestion" or something else |
I dont care. Imo it is fine as u did it :) |
application/src/main/java/org/togetherjava/tjbot/commands/basic/SuggestionsUpDownVoter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit more tricky, but currently the UX suffers from the generic thread names:
I think we can not release it like that and need some way to distinguish them.
I would suggest we determine the title based on the first x characters from the message. It is not perfect, but enough to make it clear what the thread is about. So in this case Discussion for 'I have a great idea'
or just I have a great idea
without the fuzz around it.
Code-wise, it could look something like message.getContent()
and then substring(0, Math.min(MAX_LENGTH, content.length())
. Where the max length could be something around 60 maybe.
If you want, you can also make the substring smarter by cutting off at the last "word" to not have something like I have a gre
where its cut in the middle of the word. The code for something like already exists in ImplicitAskListener#createTitle
where you can get some inspiration, if you want to.
yes, i did private static void createThread(@NotNull Message message) {
String messageContent = message.getContentRaw();
String title = messageContent;
if (messageContent.length() >= TITLE_MAX_LENGTH) {
int lastWordEnd = messageContent.lastIndexOf(' ', TITLE_MAX_LENGTH);
if (lastWordEnd == -1) {
lastWordEnd = TITLE_MAX_LENGTH;
}
title = messageContent.substring(0, lastWordEnd);
}
message
.createThreadChannel(title)
.queue();
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff. Another thing that came to my mind, could you auto-invite the message author to the thread? Just add the user to it 🙂
Any thread created will automatically invite the author and the member who created the thread |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for a second approval. Otherwise merging in latest 7 days. Thanks for your contribution, well done! 🎉 |
Auto create thread for suggestions in suggestions channel.
Closes #468 .