File tree Expand file tree Collapse file tree
application/src/main/java/org/togetherjava/tjbot/commands/tags Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import org .togetherjava .tjbot .commands .SlashCommandVisibility ;
1010import org .togetherjava .tjbot .commands .utils .MessageUtils ;
1111import org .slf4j .Logger ;
12+
13+ import java .util .Collection ;
1214import java .util .List ;
1315import java .util .Objects ;
16+ import java .util .Set ;
1417import java .util .stream .Collectors ;
1518
1619/**
3033public final class TagsCommand extends SlashCommandAdapter {
3134 private final TagSystem tagSystem ;
3235 private static final Logger logger = LoggerFactory .getLogger (TagsCommand .class );
36+ private static final int MAX_TAGS_THRESHOLD_WARNING = 200 ;
3337
3438 /**
3539 * Creates a new instance, using the given tag system as base.
@@ -44,17 +48,16 @@ public TagsCommand(TagSystem tagSystem) {
4448
4549 @ Override
4650 public void onSlashCommand (@ NotNull SlashCommandEvent event ) {
47- int MAX_TAGS_THRESHOLD_WARNING = 200 ;
48- if (tagSystem . getAllIds () .size () > MAX_TAGS_THRESHOLD_WARNING ) {
51+ Collection < String > tagIds = tagSystem . getAllIds () ;
52+ if (tagIds .size () > MAX_TAGS_THRESHOLD_WARNING ) {
4953 // TODO Implement the edge case
5054
5155 logger .warn (
5256 "The amount of tags is very high and it might soon exceed the maximum character limit. The code should be adjusted to support this edge case soon." );
5357 }
54- String tagListText = tagSystem .getAllIds ()
55- .stream ()
58+ String tagListText = tagIds .stream ()
5659 .sorted ()
57- .map (tag -> "* " + tag )
60+ .map (tag -> "\u2022 " + tag )
5861 .collect (Collectors .joining ("\n " ));
5962
6063 event
You can’t perform that action at this time.
0 commit comments