99
1010/**
1111 * Class which contains all actions a Discord client accepts.
12- *
12+ * <p>
1313 * This allows you to open DM's {@link Channels#DM_CHANNEL}, specific settings
1414 * {@link Settings.App#VOICE} and much more.
1515 *
1919 * <li>iOS and Android are NOT supported</li>
2020 * <li>It opens the LAST installed Discord version (Discord, Canary, PTB)</li>
2121 * </ul>
22+ *
23+ * <p>
24+ * Example:
25+ *
26+ * <pre>
27+ * <code>
28+ * event.reply("Open Discord's secret home page!")
29+ * .addActionRow(DiscordClientAction.Guild.GUILD_HOME_CHANNEL.asLinkButton("Open home page!", event.getGuild().getId())
30+ * </code>
31+ * </pre>
32+ *
33+ * To improve readability, one might want to use a static import like:
34+ *
35+ * <pre>
36+ * <code>
37+ *
38+ *
39+ * event.reply(whoIsCommandOutput)
40+ * .addActionRow(USER.asLinkButton("Open home page!", target.getId())
41+ * </code>
42+ * </pre>
2243 */
2344public class DiscordClientAction {
2445
@@ -58,13 +79,17 @@ public static class Guild {
5879 public static final DiscordClientAction GUILDS_CREATE =
5980 new DiscordClientAction ("discord://-/guilds/create" );
6081
61- /** Beta Discord feature */
62- public static final DiscordClientAction GUILD_HOME_CHANNEL =
63- new DiscordClientAction ("discord://-/channels/{GUILD-ID}/@home" );
82+
6483 public static final DiscordClientAction GUILD_EVENT =
6584 new DiscordClientAction ("discord://-/events/{GUILD-ID}/{EVENT-ID}" );
6685 public static final DiscordClientAction GUILD_MEMBERSHIP_SCREENING =
6786 new DiscordClientAction ("discord://-/member-verification/{GUILD-ID}" );
87+
88+ /**
89+ * Beta Discord feature
90+ */
91+ public static final DiscordClientAction GUILD_HOME_CHANNEL =
92+ new DiscordClientAction ("discord://-/channels/{GUILD-ID}/@home" );
6893 }
6994
7095 /**
@@ -135,11 +160,15 @@ public static class App {
135160 public static final DiscordClientAction LOCALE =
136161 new DiscordClientAction ("discord://-/settings/locale" );
137162
138- /** @see #LINUX */
163+ /**
164+ * @see #LINUX
165+ */
139166 public static final DiscordClientAction WINDOWS =
140167 new DiscordClientAction ("discord://-/settings/windows" );
141168
142- /** @see #WINDOWS */
169+ /**
170+ * @see #WINDOWS
171+ */
143172 public static final DiscordClientAction LINUX =
144173 new DiscordClientAction ("discord://-/settings/linux" );
145174
@@ -195,7 +224,6 @@ private DiscordClientAction(String url) {
195224 * argument is lacking.
196225 *
197226 * @return A {@link String} of the URL
198- *
199227 * @see #formatUrl(String...)
200228 */
201229 public String getRawUrl () {
@@ -206,9 +234,7 @@ public String getRawUrl() {
206234 * Format's the URL with the given arguments.
207235 *
208236 * @param arguments An array of the arguments this action requires
209- *
210237 * @return The formatted URL as an {@link String}
211- *
212238 * @throws IllegalArgumentException When missing arguments
213239 */
214240 public String formatUrl (String @ NotNull ... arguments ) {
@@ -231,9 +257,7 @@ public String formatUrl(String @NotNull... arguments) {
231257 * @param label The label of the button, see {@link Button#link(String, String)} for the
232258 * requirements
233259 * @param arguments An array of the arguments this action requires
234- *
235260 * @return A {@link Button} of {@link ButtonStyle#LINK} with the given label
236- *
237261 * @throws IllegalArgumentException When missing arguments
238262 */
239263 public Button asLinkButton (@ NotNull String label , String ... arguments ) {
0 commit comments