Skip to content

Commit a816a86

Browse files
committed
Update JDA version to 4.4.0_352
1 parent 7e359e3 commit a816a86

File tree

7 files changed

+22
-44
lines changed

7 files changed

+22
-44
lines changed

buildSrc/src/main/kotlin/net/kautler/javadoc.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2020 Bjoern Kautler
2+
* Copyright 2019-2022 Bjoern Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ tasks.withType<Javadoc>().configureEach {
5656
add("https://static.javadoc.io/javax.enterprise/cdi-api/${versions["cdi"]}/")
5757
add("https://static.javadoc.io/javax.inject/javax.inject/${versions["javax.inject"]}/")
5858
add("https://static.javadoc.io/org.javacord/javacord-api/${messageFrameworkVersions.safeGet("javacord").first()}/")
59-
add("https://static.javadoc.io/net.dv8tion/JDA/${messageFrameworkVersions.safeGet("jda").first()}/")
59+
add("https://ci.dv8tion.net/job/JDA/javadoc/")
6060
}
6161
isUse = true
6262
isVersion = true

buildSrc/src/main/kotlin/net/kautler/versions.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ repositories {
3434
// have both in case JCenter is again refusing to work properly and Maven Central first
3535
mavenCentral()
3636
jcenter()
37+
maven("https://m2.dv8tion.net/releases")
3738
}
3839

3940
val messageFrameworkVersions by extra(mapOf(
4041
"javacord" to listOf("3.4.0"),
41-
"jda" to listOf("4.2.0_214")
42+
"jda" to listOf("4.4.0_352")
4243
))
4344

4445
val versions by extra(mapOf(

examples/simplePingBotJda/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2020 Björn Kautler
2+
* Copyright 2019-2022 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ plugins {
2121
repositories {
2222
mavenCentral()
2323
jcenter()
24+
maven("https://m2.dv8tion.net/releases")
2425
}
2526

2627
dependencies {
@@ -30,7 +31,7 @@ dependencies {
3031
runtimeOnly("org.jboss.weld.se:weld-se-core:3.1.2.Final") { because("CDI implementation") }
3132
runtimeOnly("org.jboss:jandex:2.1.1.Final") { because("faster CDI bean scanning") }
3233

33-
implementation("net.dv8tion:JDA:4.2.0_214") {
34+
implementation("net.dv8tion:JDA:4.4.0_352") {
3435
exclude("club.minnced", "opus-java")
3536
exclude("com.google.code.findbugs", "jsr305")
3637
}

src/main/java/net/kautler/command/api/restriction/jda/RegularUserJda.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class RegularUserJda implements Restriction<Message> {
3434
@Override
3535
public boolean allowCommand(CommandContext<? extends Message> commandContext) {
3636
return Optional.of(commandContext.getMessage().getAuthor())
37-
.filter(author -> !author.isFake())
37+
.filter(author -> !author.isSystem())
3838
.map(author -> !author.isBot())
3939
.orElse(FALSE);
4040
}

src/main/java/net/kautler/command/api/restriction/jda/UserJda.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ public boolean allowCommand(CommandContext<? extends Message> commandContext) {
198198
*/
199199
private boolean allowCommandByUserId(Message message) {
200200
return Optional.of(message.getAuthor())
201-
.filter(author -> !author.isFake())
202201
.map(ISnowflake::getIdLong)
203202
.map(authorId -> authorId == userId)
204203
.orElse(FALSE);
@@ -212,7 +211,6 @@ private boolean allowCommandByUserId(Message message) {
212211
*/
213212
private boolean allowCommandByUserName(Message message) {
214213
return Optional.of(message.getAuthor())
215-
.filter(author -> !author.isFake())
216214
.map(User::getName)
217215
.map(authorName -> {
218216
if (this.userName == null) {

src/test/groovy/net/kautler/command/api/restriction/jda/RegularUserJdaTest.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package net.kautler.command.api.restriction.jda
1818

19+
import javax.inject.Inject
20+
1921
import net.dv8tion.jda.api.entities.Message
2022
import net.dv8tion.jda.api.entities.User
2123
import net.kautler.command.api.CommandContext
@@ -24,8 +26,6 @@ import org.junit.Rule
2426
import spock.lang.Specification
2527
import spock.lang.Subject
2628

27-
import javax.inject.Inject
28-
2929
class RegularUserJdaTest extends Specification {
3030
@Rule
3131
WeldInitiator weld = WeldInitiator
@@ -43,19 +43,19 @@ class RegularUserJdaTest extends Specification {
4343
}
4444
}
4545

46-
def 'fake author #fake and regular user author #regularUser should #be allowed'() {
46+
def 'system user author #systemUser and bot user author #botUser should #be allowed'() {
4747
given:
4848
commandContext.message.author.with {
49-
it.fake >> fake
50-
it.bot >> !regularUser
49+
it.system >> systemUser
50+
it.bot >> botUser
5151
}
5252

5353
expect:
5454
regularUserJda.allowCommand(commandContext) == allowed
5555

5656
where:
57-
[fake, regularUser] << ([[true, false]] * 2).combinations()
58-
allowed = !fake && regularUser
57+
[systemUser, botUser] << ([[true, false]] * 2).combinations()
58+
allowed = !systemUser && !botUser
5959
be = allowed ? 'be' : 'not be'
6060
}
6161
}

src/test/groovy/net/kautler/command/api/restriction/jda/UserJdaTest.groovy

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package net.kautler.command.api.restriction.jda
1818

19+
import java.util.regex.Pattern
20+
1921
import net.dv8tion.jda.api.entities.Message
2022
import net.dv8tion.jda.api.entities.User
2123
import net.kautler.command.api.CommandContext
@@ -25,23 +27,11 @@ import spock.lang.Specification
2527
import spock.lang.Subject
2628
import spock.util.mop.Use
2729

28-
import java.util.regex.Pattern
29-
3030
@Subject(UserJda)
3131
class UserJdaTest extends Specification {
32-
CommandContext<Message> commandContextByFakeUser = Stub {
33-
it.message >> Stub(Message) {
34-
it.author >> Stub(User) {
35-
it.fake >> true
36-
}
37-
}
38-
}
39-
4032
CommandContext<Message> commandContext = Stub {
4133
it.message >> Stub(Message) {
42-
it.author >> Stub(User) {
43-
it.fake >> false
44-
}
34+
it.author >> Stub(User)
4535
}
4636
}
4737

@@ -50,12 +40,9 @@ class UserJdaTest extends Specification {
5040
UserJda userJda = Spy(constructorArgs: [expectedUserId])
5141

5242
and:
53-
[commandContext, commandContextByFakeUser].each {
54-
it.message.author.idLong >> actualUserId
55-
}
43+
commandContext.message.author.idLong >> actualUserId
5644

5745
expect:
58-
!userJda.allowCommand(commandContextByFakeUser)
5946
userJda.allowCommand(commandContext) == allowed
6047

6148
where:
@@ -70,12 +57,9 @@ class UserJdaTest extends Specification {
7057
UserJda userJda = Spy(constructorArgs: [expectedUserName])
7158

7259
and:
73-
[commandContext, commandContextByFakeUser].each {
74-
it.message.author.name >> actualUserName
75-
}
60+
commandContext.message.author.name >> actualUserName
7661

7762
expect:
78-
!userJda.allowCommand(commandContextByFakeUser)
7963
userJda.allowCommand(commandContext) == allowed
8064

8165
where:
@@ -90,12 +74,9 @@ class UserJdaTest extends Specification {
9074
UserJda userJda = Spy(constructorArgs: [expectedUserName, false])
9175

9276
and:
93-
[commandContext, commandContextByFakeUser].each {
94-
it.message.author.name >> actualUserName
95-
}
77+
commandContext.message.author.name >> actualUserName
9678

9779
expect:
98-
!userJda.allowCommand(commandContextByFakeUser)
9980
userJda.allowCommand(commandContext) == allowed
10081

10182
where:
@@ -110,12 +91,9 @@ class UserJdaTest extends Specification {
11091
UserJda userJda = Spy(constructorArgs: [expectedUserPattern])
11192

11293
and:
113-
[commandContext, commandContextByFakeUser].each {
114-
it.message.author.name >> actualUserName
115-
}
94+
commandContext.message.author.name >> actualUserName
11695

11796
expect:
118-
!userJda.allowCommand(commandContextByFakeUser)
11997
userJda.allowCommand(commandContext) == allowed
12098

12199
where:

0 commit comments

Comments
 (0)