Skip to content

Commit 6b1b817

Browse files
authored
Merge branch 'discord-jda:master' into master
2 parents 3dba327 + 4198fea commit 6b1b817

120 files changed

Lines changed: 1602 additions & 1437 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/validate.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,21 @@ jobs:
2020
uses: gradle/actions/setup-gradle@v4
2121
- name: Build and test
2222
run: ./gradlew --build-cache --parallel build test
23+
- name: Upload JUnit XML Test Report
24+
if: ${{ !cancelled() }}
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: junit-xml-test-report
28+
path: build/test-results/test
29+
- name: Upload HTML Test Report
30+
if: ${{ !cancelled() }}
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: junit-html-test-report
34+
path: build/reports/tests/test
35+
- name: Annotate Failed Tests
36+
uses: mikepenz/action-junit-report@v5
37+
if: ${{ !cancelled() }}
38+
with:
39+
report_paths: '**/build/test-results/test/TEST-*.xml'
40+
annotate_only: 'true'

build.gradle.kts

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ plugins {
4747
////////////////////////////////////
4848

4949
projectEnvironment {
50-
version = Version(major = "6", minor = "0", revision = "0", classifier = "rc.1")
50+
version = Version(major = "6", minor = "0", revision = "0", classifier = "rc.3")
5151
}
5252

5353
artifactFilters {
@@ -90,6 +90,8 @@ configure<SourceSetContainer> {
9090
// //
9191
////////////////////////////////////
9292

93+
val mockitoAgent by configurations.creating
94+
9395
repositories {
9496
mavenCentral()
9597
}
@@ -143,6 +145,10 @@ dependencies {
143145
testImplementation(libs.logback.classic)
144146
testImplementation(libs.archunit)
145147

148+
mockitoAgent(libs.mockito) {
149+
isTransitive = false
150+
}
151+
146152
// OpenRewrite
147153
// Import Rewrite's bill of materials.
148154
testImplementation(platform("org.openrewrite.recipe:rewrite-recipe-bom:3.6.1"))
@@ -318,17 +324,15 @@ tasks.withType<JavaCompile> {
318324
args.add("8")
319325
}
320326

321-
doFirst {
322-
options.compilerArgs = args
323-
}
327+
options.compilerArgs.addAll(args)
324328
}
325329

326-
val compileJava by tasks.getting(JavaCompile::class) {
330+
tasks.named<JavaCompile>("compileJava").configure {
327331
dependsOn(generateJavaSources)
328332
source = generateJavaSources.get().source
329333
}
330334

331-
val build by tasks.getting(Task::class) {
335+
tasks.build.configure {
332336
dependsOn(jar)
333337
dependsOn(javadocJar)
334338
dependsOn(sourcesJar)
@@ -340,6 +344,14 @@ val build by tasks.getting(Task::class) {
340344
shadowJar.mustRunAfter(sourcesJar)
341345
}
342346

347+
348+
////////////////////////////////////
349+
// //
350+
// Test Configuration //
351+
// //
352+
////////////////////////////////////
353+
354+
343355
val downloadRecipeClasspath by tasks.registering(Download::class) {
344356
val targetVersion = "5.6.1"
345357
src("https://repo.maven.apache.org/maven2/net/dv8tion/JDA/$targetVersion/JDA-$targetVersion.jar")
@@ -351,18 +363,37 @@ tasks.named("processTestResources").configure {
351363
dependsOn(downloadRecipeClasspath)
352364
}
353365

354-
val test by tasks.getting(Test::class) {
366+
367+
tasks.register<Test>("updateTestSnapshots") {
368+
group = "verification"
355369
useJUnitPlatform()
356-
failFast = false
370+
371+
testClassesDirs = sourceSets.test.get().output.classesDirs
372+
classpath = sourceSets.test.get().runtimeClasspath
373+
374+
systemProperty("updateSnapshots", "true")
357375
}
358376

359-
val updateTestSnapshots by tasks.registering(Test::class) {
377+
tasks.withType<Test>().configureEach {
360378
useJUnitPlatform()
361379
failFast = false
362380

363-
systemProperty("updateSnapshots", "true")
381+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
382+
jvmArgs = listOf("-javaagent:${mockitoAgent.asPath}")
383+
}
364384
}
365385

386+
tasks.test {
387+
testLogging {
388+
events("passed", "skipped", "failed")
389+
}
390+
reports {
391+
junitXml.required = projectEnvironment.isGithubAction
392+
html.required = projectEnvironment.isGithubAction
393+
}
394+
}
395+
396+
366397
////////////////////////////////////
367398
// //
368399
// Publishing And Signing //

gradle/wrapper/gradle-wrapper.jar

1.65 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/net/dv8tion/jda/api/JDA.java

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ default CommandCreateAction upsertCommand(@Nonnull String name, @Nonnull String
789789
* jda.updateCommands()
790790
* .addCommands(Commands.slash("ping", "Gives the current ping"))
791791
* .addCommands(Commands.slash("ban", "Ban the target user")
792-
* .setGuildOnly(true)
792+
* .setContexts(InteractionContextType.GUILD)
793793
* .setDefaultPermissions(DefaultMemberPermissions.enabledFor(Permission.BAN_MEMBERS))
794794
* .addOption(OptionType.USER, "user", "The user to ban", true))
795795
* .queue();
@@ -917,59 +917,6 @@ default RestAction<Void> deleteCommandById(long commandId)
917917
@CheckReturnValue
918918
RestAction<List<RoleConnectionMetadata>> updateRoleConnectionMetadata(@Nonnull Collection<? extends RoleConnectionMetadata> records);
919919

920-
/**
921-
* Constructs a new {@link Guild Guild} with the specified name
922-
* <br>Use the returned {@link GuildAction GuildAction} to provide
923-
* further details and settings for the resulting Guild!
924-
*
925-
* <p>This RestAction does not provide the resulting Guild!
926-
* It will be in a following {@link net.dv8tion.jda.api.events.guild.GuildJoinEvent GuildJoinEvent}.
927-
*
928-
* @param name
929-
* The name of the resulting guild
930-
*
931-
* @throws java.lang.IllegalStateException
932-
* If the currently logged in account is in 10 or more guilds
933-
* @throws java.lang.IllegalArgumentException
934-
* If the provided name is empty, {@code null} or not between 2-100 characters
935-
*
936-
* @return {@link GuildAction GuildAction}
937-
* <br>Allows for setting various details for the resulting Guild
938-
*/
939-
@Nonnull
940-
@CheckReturnValue
941-
GuildAction createGuild(@Nonnull String name);
942-
943-
/**
944-
* Constructs a new {@link Guild Guild} from the specified template code.
945-
*
946-
* <p>This RestAction does not provide the resulting Guild!
947-
* It will be in a following {@link net.dv8tion.jda.api.events.guild.GuildJoinEvent GuildJoinEvent}.
948-
*
949-
* <p>Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} include:
950-
* <ul>
951-
* <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_GUILD_TEMPLATE Unknown Guild Template}
952-
* <br>The template doesn't exist.</li>
953-
* </ul>
954-
*
955-
* @param code
956-
* The template code to use to create a guild
957-
* @param name
958-
* The name of the resulting guild
959-
* @param icon
960-
* The {@link net.dv8tion.jda.api.entities.Icon Icon} to use, or null to use no icon
961-
*
962-
* @throws java.lang.IllegalStateException
963-
* If the currently logged in account is in 10 or more guilds
964-
* @throws java.lang.IllegalArgumentException
965-
* If the provided name is empty, {@code null} or not between 2-100 characters
966-
*
967-
* @return {@link net.dv8tion.jda.api.requests.RestAction RestAction}
968-
*/
969-
@Nonnull
970-
@CheckReturnValue
971-
RestAction<Void> createGuildFromTemplate(@Nonnull String code, @Nonnull String name, @Nullable Icon icon);
972-
973920
/**
974921
* {@link net.dv8tion.jda.api.utils.cache.CacheView CacheView} of
975922
* all cached {@link net.dv8tion.jda.api.managers.AudioManager AudioManagers} created for this JDA instance.
@@ -1170,25 +1117,25 @@ default List<User> getUsersByName(@Nonnull String name, boolean ignoreCase)
11701117
* @param users
11711118
* The users which all the returned {@link Guild Guilds} must contain.
11721119
*
1173-
* @return Immutable list of all {@link Guild Guild} instances which have all {@link net.dv8tion.jda.api.entities.User Users} in them.
1120+
* @return Immutable list of all {@link Guild Guild} instances which have all {@link net.dv8tion.jda.api.entities.UserSnowflake Users} in them.
11741121
*
11751122
* @see Guild#isMember(UserSnowflake)
11761123
*/
11771124
@Nonnull
11781125
@Unmodifiable
1179-
List<Guild> getMutualGuilds(@Nonnull User... users);
1126+
List<Guild> getMutualGuilds(@Nonnull UserSnowflake... users);
11801127

11811128
/**
11821129
* Gets all {@link Guild Guilds} that contain all given users as their members.
11831130
*
11841131
* @param users
11851132
* The users which all the returned {@link Guild Guilds} must contain.
11861133
*
1187-
* @return Immutable list of all {@link Guild Guild} instances which have all {@link net.dv8tion.jda.api.entities.User Users} in them.
1134+
* @return Immutable list of all {@link Guild Guild} instances which have all {@link net.dv8tion.jda.api.entities.UserSnowflake Users} in them.
11881135
*/
11891136
@Nonnull
11901137
@Unmodifiable
1191-
List<Guild> getMutualGuilds(@Nonnull Collection<User> users);
1138+
List<Guild> getMutualGuilds(@Nonnull Collection<? extends UserSnowflake> users);
11921139

11931140
/**
11941141
* Attempts to retrieve a {@link net.dv8tion.jda.api.entities.User User} object based on the provided id.

src/main/java/net/dv8tion/jda/api/Permission.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public enum Permission
6565
MESSAGE_ATTACH_VOICE_MESSAGE(46, true, true, "Send Voice Messages"),
6666
MESSAGE_SEND_POLLS( 49, true, true, "Create Polls"),
6767
USE_EXTERNAL_APPLICATIONS( 50, true, true, "Use External Apps"),
68+
PIN_MESSAGES( 51, true, true, "Pin Messages"),
6869

6970
// Thread Permissions
7071
MANAGE_THREADS( 34, true, true, "Manage Threads"),

src/main/java/net/dv8tion/jda/api/components/Component.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
import net.dv8tion.jda.api.components.container.ContainerChildComponent;
2424
import net.dv8tion.jda.api.components.section.SectionAccessoryComponent;
2525
import net.dv8tion.jda.api.components.section.SectionContentComponent;
26-
import net.dv8tion.jda.api.interactions.modals.Modal;
27-
import net.dv8tion.jda.api.interactions.modals.ModalTopLevelComponent;
26+
import net.dv8tion.jda.api.modals.Modal;
2827

2928
import javax.annotation.CheckReturnValue;
3029
import javax.annotation.Nonnull;

src/main/java/net/dv8tion/jda/api/components/Components.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
import net.dv8tion.jda.api.components.tree.ComponentTree;
2020
import net.dv8tion.jda.api.components.tree.MessageComponentTree;
21-
import net.dv8tion.jda.api.interactions.modals.ModalTopLevelComponentUnion;
22-
import net.dv8tion.jda.api.interactions.modals.tree.ModalComponentTree;
21+
import net.dv8tion.jda.api.components.tree.ModalComponentTree;
2322
import net.dv8tion.jda.api.utils.data.DataArray;
2423
import net.dv8tion.jda.api.utils.data.DataObject;
2524
import net.dv8tion.jda.internal.components.UnknownComponentImpl;

src/main/java/net/dv8tion/jda/api/components/IComponentUnion.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import net.dv8tion.jda.api.components.container.ContainerChildComponentUnion;
2121
import net.dv8tion.jda.api.components.section.SectionAccessoryComponentUnion;
2222
import net.dv8tion.jda.api.components.section.SectionContentComponentUnion;
23-
import net.dv8tion.jda.api.interactions.modals.ModalTopLevelComponentUnion;
2423

2524
import javax.annotation.Nonnull;
2625

0 commit comments

Comments
 (0)