Skip to content

Commit 2c386dc

Browse files
authored
Thread based help system (#445)
PoC for thread overview Auto update more frequently, adding close command Removed old free-system Adjust top helper system Implicit ask listener, invite author to thread, more stable listening Added user cooldown Adjusted cooldown time Adding tags and auto-invite helpers tag -> category (to avoid confusion with tag system) Change help category command Added categorizing of active question overview getGuilds() -> getGuildCache() (CR Tais) Bot message cleanup routine invite helpers via soft-ping Fixed some bug with the overview sorting overview by creation time desc changing cleanup timer 5min -> 2min Bugfix with overview message retrieval added "how to ask" explanation improved "how to ask" explanation Bugfix wrong messages selected as status messages Removed code duplication, code polish Javadoc bugfix with change category not matching Fixed missing docs Overloads should be placed next to each other (linter)
1 parent 15c0115 commit 2c386dc

24 files changed

+1177
-1277
lines changed

application/config.json.template

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
"heavyModerationRolePattern": "Moderator",
99
"softModerationRolePattern": "Moderator|Staff Assistant",
1010
"tagManageRolePattern": "Moderator|Staff Assistant|Top Helpers .+",
11-
"freeCommand": [
12-
{
13-
"inactiveChannelDuration": "PT2H",
14-
"messageRetrieveLimit": 10,
15-
"statusChannel": <put_a_channel_id_here>,
16-
"monitoredChannels": [
17-
<put_a_channel_id_here>
18-
]
19-
}
20-
],
2111
"helpChannelPattern": "([a-zA-Z_]+_)?help(_\\d+)?",
2212
"suggestions": {
2313
"channelPattern": "tj_suggestions",
@@ -33,5 +23,26 @@
3323
"suspiciousHostKeywords": ["discord", "nitro", "premium"],
3424
"isHostSimilarToKeywordDistanceThreshold": 2
3525
},
36-
"wolframAlphaAppId": "79J52T-6239TVXHR7"
26+
"wolframAlphaAppId": "79J52T-6239TVXHR7",
27+
"helpSystem": {
28+
"stagingChannelPattern": "ask_here",
29+
"overviewChannelPattern": "active_questions",
30+
"categories": [
31+
"Java",
32+
"Frameworks",
33+
"JavaFX|Swing",
34+
"IDE",
35+
"Build Tools",
36+
"Database",
37+
"Android",
38+
"C|C++",
39+
"Algorithms",
40+
"Math",
41+
"Architecture",
42+
"Code Review",
43+
"Together Java Bot",
44+
"Other"
45+
],
46+
"categoryRoleSuffix": " - Helper"
47+
}
3748
}

application/src/main/java/org/togetherjava/tjbot/commands/Features.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
import org.togetherjava.tjbot.commands.basic.RoleSelectCommand;
77
import org.togetherjava.tjbot.commands.basic.SuggestionsUpDownVoter;
88
import org.togetherjava.tjbot.commands.basic.VcActivityCommand;
9-
import org.togetherjava.tjbot.commands.free.AutoFreeRoutine;
10-
import org.togetherjava.tjbot.commands.free.FreeChannelMonitor;
11-
import org.togetherjava.tjbot.commands.free.FreeCommand;
9+
import org.togetherjava.tjbot.commands.help.*;
1210
import org.togetherjava.tjbot.commands.mathcommands.TeXCommand;
1311
import org.togetherjava.tjbot.commands.mathcommands.wolframalpha.WolframAlphaCommand;
1412
import org.togetherjava.tjbot.commands.moderation.*;
@@ -62,7 +60,7 @@ public enum Features {
6260
ModerationActionsStore actionsStore = new ModerationActionsStore(database);
6361
ModAuditLogWriter modAuditLogWriter = new ModAuditLogWriter(config);
6462
ScamHistoryStore scamHistoryStore = new ScamHistoryStore(database);
65-
FreeChannelMonitor freeChannelMonitor = new FreeChannelMonitor(config);
63+
HelpSystemHelper helpSystemHelper = new HelpSystemHelper(config);
6664

6765
// NOTE The system can add special system relevant commands also by itself,
6866
// hence this list may not necessarily represent the full list of all commands actually
@@ -75,12 +73,13 @@ public enum Features {
7573
features.add(new TopHelpersPurgeMessagesRoutine(database));
7674
features.add(new RemindRoutine(database));
7775
features.add(new ScamHistoryPurgeRoutine(scamHistoryStore));
78-
features.add(new AutoFreeRoutine(freeChannelMonitor));
76+
features.add(new BotMessageCleanup(config));
7977

8078
// Message receivers
8179
features.add(new TopHelpersMessageListener(database, config));
8280
features.add(new SuggestionsUpDownVoter(config));
8381
features.add(new ScamBlocker(actionsStore, scamHistoryStore, config));
82+
features.add(new ImplicitAskListener(config, helpSystemHelper));
8483

8584
// Event receivers
8685
features.add(new RejoinModerationRoleListener(actionsStore, config));
@@ -107,9 +106,12 @@ public enum Features {
107106
features.add(new UnquarantineCommand(actionsStore, config));
108107
features.add(new WhoIsCommand());
109108
features.add(new WolframAlphaCommand(config));
109+
features.add(new AskCommand(config, helpSystemHelper));
110+
features.add(new CloseCommand(helpSystemHelper));
111+
features.add(new ChangeHelpCategoryCommand(config, helpSystemHelper));
110112

111113
// Mixtures
112-
features.add(new FreeCommand(config, freeChannelMonitor));
114+
features.add(new HelpThreadOverviewUpdater(config, helpSystemHelper));
113115

114116
return features;
115117
}

application/src/main/java/org/togetherjava/tjbot/commands/Routine.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@
1616
* the schedule defined by {@link #createSchedule()}.
1717
*/
1818
public interface Routine extends Feature {
19-
/**
20-
* Triggered by the core system on the schedule defined by {@link #createSchedule()}.
21-
*
22-
* @param jda the JDA instance the bot is operating with
23-
*/
24-
void runRoutine(@NotNull JDA jda);
25-
2619
/**
2720
* Retrieves the schedule of this routine. Called by the core system once during the startup in
2821
* order to execute the routine accordingly.
@@ -34,6 +27,13 @@ public interface Routine extends Feature {
3427
@NotNull
3528
Schedule createSchedule();
3629

30+
/**
31+
* Triggered by the core system on the schedule defined by {@link #createSchedule()}.
32+
*
33+
* @param jda the JDA instance the bot is operating with
34+
*/
35+
void runRoutine(@NotNull JDA jda);
36+
3737
/**
3838
* The schedule of routines.
3939
*

application/src/main/java/org/togetherjava/tjbot/commands/free/AutoFreeRoutine.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

application/src/main/java/org/togetherjava/tjbot/commands/free/ChannelStatus.java

Lines changed: 0 additions & 208 deletions
This file was deleted.

0 commit comments

Comments
 (0)