Skip to content

Migrated help system to forums #705

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

Merged
merged 2 commits into from
Dec 9, 2022
Merged

Conversation

Zabuzard
Copy link
Member

@Zabuzard Zabuzard commented Nov 30, 2022

Overview

Implements and closes #585.

Migrates our help system to a Discord forum channel.

meme

Details

Most of the migration is actually fairly simple and straightforward, because forum posts are still just regular ThreadChannels. 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.

overview

single thread

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)
  • validation for valid titles and title extraction
  • question overview HelpThreadOverviewUpdater

Tags

Forum tags are fairly straightforward. We simply add a tag for each category and for each activity:

tag settings

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 (see HelpSystemHelper#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 the ImplicitAskListener anymore, we created HelpThreadCreatedListener, 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 and overviewChannelPattern by

"helpForumPattern": "questions"

Discord

  1. Create a forum called questions (according to the config).
  2. Give it a tag for each of the categories, selectable by normal users.
  3. Give it tags for the activities, they should only be selectable by mods. Names:
  • Active
  • Needs attention
  • Nobody helped yet
  1. Require that users select a tag when posting

tag settings

activity tag setting

Checklist

  • config
  • migrate misc users (bookmarks, top helper, ...)
  • categories based on tags
  • activity based on tags
  • AskCommand -> on channel created listener
  • multiple selected tags, ping all?
  • polish

@Zabuzard Zabuzard added enhancement New feature or request priority: major labels Nov 30, 2022
@Zabuzard Zabuzard self-assigned this Nov 30, 2022
@Zabuzard Zabuzard force-pushed the feature/migrate_help_to_forums branch 3 times, most recently from 385c3d0 to dad9e05 Compare December 2, 2022 13:07
@Zabuzard Zabuzard marked this pull request as ready for review December 2, 2022 13:21
@Zabuzard Zabuzard requested review from a team as code owners December 2, 2022 13:21
@java-coding-prodigy
Copy link
Contributor

java-coding-prodigy commented Dec 4, 2022

If people make the forums themselves, what's the use of the bot then?
Is it just going to update the tags when answers are given and give the asker advice?

@Zabuzard
Copy link
Member Author

Zabuzard commented Dec 4, 2022

If people make the forums themselves, what's the use of the bot then?

  • explanation message
  • soft-ping corresponding helpers
  • activity indicators
  • auto-close after 12h
  • probably some other stuff i forgot

@Zabuzard Zabuzard force-pushed the feature/migrate_help_to_forums branch from dad9e05 to c176c32 Compare December 9, 2022 11:03
@Zabuzard
Copy link
Member Author

Zabuzard commented Dec 9, 2022

(just rebased)

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Zabuzard Zabuzard merged commit 96de17f into develop Dec 9, 2022
@Zabuzard Zabuzard deleted the feature/migrate_help_to_forums branch December 9, 2022 11:13
@Zabuzard Zabuzard mentioned this pull request Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: major
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate help system to forums
4 participants