Migrated help system to forums #705
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Implements and closes #585.
Migrates our help system to a Discord forum channel.
Details
Most of the migration is actually fairly simple and straightforward, because forum posts are still just regular
ThreadChannel
s. So most of our code works out of the box.The first change that had to be done is to adjust the config to go from 2 channels to just one
"helpForumPattern": "question"
. Obviously, this yields a couple of minor renaming changes in many classes that observe messages in threads of this channel (e.g. TopHelper, Bookmarks, ...).In terms of the actual logic, the only real change are the semantics of thread categories and activity. In the past, they have been attached to a thread in its title, e.g.
🔻 [Java] How to write Hello World?
. Forums actually have dedicated tags which can be used for that. So we moved the categories and activity into forum-tags.The second bigger change was that we do not have a controlled entry-point into the logic anymore (no
/ask
command or implicit ask listener). So we had to move some logic (explanation message, ...) into an event handler.Removed features
Forums bring a lot of functionality out of the box, making the following features obsolete:
/ask
ImplicitAskListener
BotMessageCleanup
(since we do not have a staging channel with implicit posts anymore)HelpThreadOverviewUpdater
Tags
Forum tags are fairly straightforward. We simply add a tag for each category and for each activity:
The code can read the applied tags and find/apply them by name, easy. The code changes for this are all in
HelpSystemHelper
, where we could remove all the renaming/title extraction logic and replace it by using forum tags.Discord actually has a limit of 5 tags per thread and also allows the user to select multiple. This creates a couple of edge cases that we have to handle. For example, the user can now select multiple categories, i.e.
Java, Frameworks, Spring, JavaFX/Swing
.We probably dont want to ping all of them, so the system will only look at the first selected category and identify as primary tag, only pinging those helpers. The
/help-thread change category
command has to correctly respect that, deleting the first tag, possibly deleting the desired tag if its somewhere at the end of the list, and then prepend it (seeHelpSystemHelper#changeChannelCategory
). The activity tags are handled in the same way.If the user already selected 5 tags (the max) and the bot then wants to add the activity tag, it will delete the last tag in the list first.
Entry point
Since we do not have
/ask
and theImplicitAskListener
anymore, we createdHelpThreadCreatedListener
, reacting to the event of threads being created in the forum channel.Essentially, we just copy pasted the logic from
/ask
over to here, sending the explanation message and pinging helpers.The text had some minor adjustments, due to the change of the flow. For example, we do not have to write "
@John
has a question and will send the details now" anymore, since the user created the thread themselves (no attention-ping needed) and they already entered their details, since Discord forces writing a description.Release
Config
Replaced
stagingChannelPattern
andoverviewChannelPattern
byDiscord
questions
(according to the config).categories
, selectable by normal users.Active
Needs attention
Nobody helped yet
Checklist