Skip to content

Commit 92c5621

Browse files
committed
docs: provide JavaDocs
1 parent 242e725 commit 92c5621

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

application/src/main/java/org/togetherjava/tjbot/features/dynamicvc/DynamicVoiceListener.java

+22
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,35 @@
2626
import java.util.stream.IntStream;
2727
import java.util.stream.Stream;
2828

29+
/**
30+
* {@link DynamicVoiceListener} is a feature that dynamically manages voice channels within a
31+
* Discord guild based on user activity.
32+
* <p>
33+
* It is designed to handle events related to voice channel updates (e.g. when users join or leave
34+
* voice channels). It dynamically creates or deletes voice channels to ensure there is always
35+
* <i>one</i> available empty channel for users to join, and removes duplicate empty channels to
36+
* avoid clutter.
37+
* <p>
38+
* This feature relies on configurations provided at initialization to determine the patterns for
39+
* channel names it should manage. The configuration is expected to provide a list of regular
40+
* expression patterns for these channel names.
41+
*/
2942
public class DynamicVoiceListener extends VoiceReceiverAdapter {
3043

3144
private final Map<String, Predicate<String>> channelPredicates = new HashMap<>();
3245
private static final Pattern channelTopicPattern = Pattern.compile("(\\s+\\d+)$");
46+
47+
/** Map of event queues for each channel topic. */
3348
private static final Map<String, Queue<GuildVoiceUpdateEvent>> eventQueues = new HashMap<>();
49+
50+
/** Map to track if an event queue is currently being processed for each channel topic. */
3451
private static final Map<String, AtomicBoolean> activeQueuesMap = new HashMap<>();
3552

53+
/**
54+
* Initializes a new {@link DynamicVoiceListener} with the specified configuration.
55+
*
56+
* @param config the configuration containing dynamic voice channel patterns
57+
*/
3658
public DynamicVoiceListener(Config config) {
3759
config.getDynamicVoiceChannelPatterns().forEach(pattern -> {
3860
channelPredicates.put(pattern, Pattern.compile(pattern).asMatchPredicate());

0 commit comments

Comments
 (0)