9
9
10
10
/**
11
11
* Class which contains all actions a Discord client accepts.
12
- *
12
+ * <p>
13
13
* This allows you to open DM's {@link Channels#DM_CHANNEL}, specific settings
14
14
* {@link Settings.App#VOICE} and much more.
15
15
*
19
19
* <li>iOS and Android are NOT supported</li>
20
20
* <li>It opens the LAST installed Discord version (Discord, Canary, PTB)</li>
21
21
* </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>
22
43
*/
23
44
public class DiscordClientAction {
24
45
@@ -58,13 +79,17 @@ public static class Guild {
58
79
public static final DiscordClientAction GUILDS_CREATE =
59
80
new DiscordClientAction ("discord://-/guilds/create" );
60
81
61
- /** Beta Discord feature */
62
- public static final DiscordClientAction GUILD_HOME_CHANNEL =
63
- new DiscordClientAction ("discord://-/channels/{GUILD-ID}/@home" );
82
+
64
83
public static final DiscordClientAction GUILD_EVENT =
65
84
new DiscordClientAction ("discord://-/events/{GUILD-ID}/{EVENT-ID}" );
66
85
public static final DiscordClientAction GUILD_MEMBERSHIP_SCREENING =
67
86
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" );
68
93
}
69
94
70
95
/**
@@ -135,11 +160,15 @@ public static class App {
135
160
public static final DiscordClientAction LOCALE =
136
161
new DiscordClientAction ("discord://-/settings/locale" );
137
162
138
- /** @see #LINUX */
163
+ /**
164
+ * @see #LINUX
165
+ */
139
166
public static final DiscordClientAction WINDOWS =
140
167
new DiscordClientAction ("discord://-/settings/windows" );
141
168
142
- /** @see #WINDOWS */
169
+ /**
170
+ * @see #WINDOWS
171
+ */
143
172
public static final DiscordClientAction LINUX =
144
173
new DiscordClientAction ("discord://-/settings/linux" );
145
174
@@ -195,7 +224,6 @@ private DiscordClientAction(String url) {
195
224
* argument is lacking.
196
225
*
197
226
* @return A {@link String} of the URL
198
- *
199
227
* @see #formatUrl(String...)
200
228
*/
201
229
public String getRawUrl () {
@@ -206,9 +234,7 @@ public String getRawUrl() {
206
234
* Format's the URL with the given arguments.
207
235
*
208
236
* @param arguments An array of the arguments this action requires
209
- *
210
237
* @return The formatted URL as an {@link String}
211
- *
212
238
* @throws IllegalArgumentException When missing arguments
213
239
*/
214
240
public String formatUrl (String @ NotNull ... arguments ) {
@@ -231,9 +257,7 @@ public String formatUrl(String @NotNull... arguments) {
231
257
* @param label The label of the button, see {@link Button#link(String, String)} for the
232
258
* requirements
233
259
* @param arguments An array of the arguments this action requires
234
- *
235
260
* @return A {@link Button} of {@link ButtonStyle#LINK} with the given label
236
- *
237
261
* @throws IllegalArgumentException When missing arguments
238
262
*/
239
263
public Button asLinkButton (@ NotNull String label , String ... arguments ) {
0 commit comments