File tree Expand file tree Collapse file tree 5 files changed +18
-13
lines changed
annotations/src/main/java/com/javadiscord/jdi/core/processor/validator
api/src/main/java/com/javadiscord/jdi
core/api/builders/command
internal/api/application_commands
core/src/main/java/com/javadiscord/jdi/core
example/lj-discord-bot/src/main/java/com/javadiscord/bot/utils Expand file tree Collapse file tree 5 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -416,10 +416,11 @@ private boolean validateMethodAnnotations(Method method) {
416
416
for (Map .Entry <Class <? extends Annotation >, String []> entry : EXPECTED_PARAM_TYPES_MAP
417
417
.entrySet ()) {
418
418
Class <? extends Annotation > annotationClass = entry .getKey ();
419
- if (method .isAnnotationPresent (annotationClass )) {
420
- if (!validateMethodParameters (method , entry .getValue ())) {
421
- return false ;
422
- }
419
+ if (
420
+ method .isAnnotationPresent (annotationClass )
421
+ && !validateMethodParameters (method , entry .getValue ())
422
+ ) {
423
+ return false ;
423
424
}
424
425
}
425
426
return true ;
Original file line number Diff line number Diff line change @@ -35,8 +35,6 @@ public class CallbackMessage {
35
35
@ JsonProperty ("poll" )
36
36
private Poll poll ;
37
37
38
- public CallbackMessage () {}
39
-
40
38
public boolean isTts () {
41
39
return tts ;
42
40
}
Original file line number Diff line number Diff line change 4
4
import java .util .List ;
5
5
import java .util .Map ;
6
6
import java .util .Optional ;
7
+ import java .util .concurrent .atomic .AtomicReference ;
7
8
8
9
import com .javadiscord .jdi .core .api .builders .command .CommandOption ;
9
10
import com .javadiscord .jdi .core .api .builders .command .CommandOptionType ;
@@ -23,11 +24,12 @@ public record CreateCommandRequest(
23
24
@ Override
24
25
public DiscordRequestBuilder create () {
25
26
26
- String path = "/applications/%s/commands" .formatted (applicationId );
27
+ AtomicReference <String > path =
28
+ new AtomicReference <>("/applications/%s/commands" .formatted (applicationId ));
27
29
28
- if ( global .isPresent () && global . get ()) {
29
- path = "/applications/%s/guilds/%s/commands" .formatted (applicationId , guildId );
30
- }
30
+ global .ifPresent (
31
+ val -> path . set ( "/applications/%s/guilds/%s/commands" .formatted (applicationId , guildId ))
32
+ );
31
33
32
34
Map <String , Object > body = new HashMap <>();
33
35
body .put ("name" , name );
@@ -41,6 +43,6 @@ public DiscordRequestBuilder create() {
41
43
return new DiscordRequestBuilder ()
42
44
.post ()
43
45
.body (body )
44
- .path (path );
46
+ .path (path . get () );
45
47
}
46
48
}
Original file line number Diff line number Diff line change @@ -23,4 +23,8 @@ public class Constants {
23
23
\\ ___/|____/___| Version 1.0
24
24
""" ;
25
25
26
+ private Constants () {
27
+ throw new UnsupportedOperationException ("Utility class" );
28
+ }
29
+
26
30
}
Original file line number Diff line number Diff line change 5
5
6
6
public class CurseWords {
7
7
public static boolean containsCurseWord (String text ) {
8
- for (String s : curseWords ) {
8
+ for (String s : CURSE_WORDS ) {
9
9
if (text .toLowerCase ().contains (s .toLowerCase ())) {
10
10
return true ;
11
11
}
12
12
}
13
13
return false ;
14
14
}
15
15
16
- private static final List <String > curseWords =
16
+ private static final List <String > CURSE_WORDS =
17
17
Arrays .asList (
18
18
"fuck" ,
19
19
"shit" ,
You can’t perform that action at this time.
0 commit comments