diff --git a/application/src/main/java/org/togetherjava/tjbot/commands/utils/DiscordClientAction.java b/application/src/main/java/org/togetherjava/tjbot/commands/utils/DiscordClientAction.java index 7a60dd9604..a1dba61977 100644 --- a/application/src/main/java/org/togetherjava/tjbot/commands/utils/DiscordClientAction.java +++ b/application/src/main/java/org/togetherjava/tjbot/commands/utils/DiscordClientAction.java @@ -7,7 +7,7 @@ import java.util.regex.Pattern; /** - * Class which contains all actions a Discord client accepts. + * Class, which contains all actions a Discord client accepts. *
* This allows you to open DM's {@link Channels#DM_CHANNEL}, specific settings * {@link Settings.App#VOICE} and much more. @@ -23,25 +23,25 @@ * Example: * *
- *
+ * {@code
* event.reply("Open Discord's secret home page!")
* .addActionRow(DiscordClientAction.Guild.GUILD_HOME_CHANNEL.asLinkButton("Open home page!", event.getGuild().getId())
- *
+ * }
*
*
* To improve readability, one might want to use a static import like:
*
*
- *
+ * {@code
* event.reply(whoIsCommandOutput)
* .addActionRow(USER.asLinkButton("Open home page!", target.getId())
- *
+ * }
*
*/
public final class DiscordClientAction {
/**
- * Contains some of the more general actions
+ * Contains some of the more general actions.
*/
public enum General {
;
@@ -65,7 +65,7 @@ public enum General {
}
/**
- * Contains guild specific actions
+ * Contains actions related to guilds.
*/
public enum Guild {
;
@@ -94,7 +94,7 @@ public enum Guild {
}
/**
- * Contains actions related to channels
+ * Contains actions related to channels.
*/
public enum Channels {
;
@@ -110,7 +110,7 @@ public enum Channels {
}
/**
- * Contains actions related to the settings menu
+ * Contains actions related to the settings menu.
*/
/*
* The warning is about this inner class being too long, and that it should be external This
@@ -122,7 +122,7 @@ public enum Settings {
;
/**
- * Contains all user settings
+ * Contains all user settings.
*/
public enum User {
;
@@ -140,7 +140,7 @@ public enum User {
}
/**
- * Contains all payment settings
+ * Contains all payment settings.
*/
public enum Payment {
;
@@ -156,7 +156,7 @@ public enum Payment {
}
/**
- * Contains all app settings
+ * Contains all app settings.
*/
public enum App {
;
@@ -195,7 +195,7 @@ public enum App {
}
/**
- * Contains some of the more general settings
+ * Contains some of the more general settings.
*/
public enum General {
;
@@ -211,6 +211,9 @@ public enum General {
}
}
+ /**
+ * Contains actions related to game libraries.
+ */
public enum Library {
;
@@ -227,15 +230,15 @@ public enum Library {
}
/**
- * Pattern for the arguments, finds everything within brackets
+ * Pattern for the arguments, finds everything within brackets.
*/
public static final Pattern argumentPattern = Pattern.compile("\\{[^}]*}");
- private final String url;
+ private final String rawUrl;
@Contract(pure = true)
private DiscordClientAction(final String url) {
- this.url = url;
+ rawUrl = url;
}
/**
@@ -249,7 +252,7 @@ private DiscordClientAction(final String url) {
* @see #formatUrl(String...)
*/
public String getRawUrl() {
- return url;
+ return rawUrl;
}
/**
@@ -260,7 +263,7 @@ public String getRawUrl() {
* @throws IllegalArgumentException When missing arguments
*/
public String formatUrl(final String... arguments) {
- String localUrl = url;
+ String localUrl = rawUrl;
for (final String argument : arguments) {
localUrl = argumentPattern.matcher(localUrl).replaceFirst(argument);
@@ -288,6 +291,6 @@ public Button asLinkButton(final String label, final String... arguments) {
@Override
public String toString() {
- return "DiscordClientAction{" + "url='" + url + '\'' + '}';
+ return "DiscordClientAction{" + "url='" + rawUrl + '\'' + '}';
}
}