Skip to content

Commit 746a97f

Browse files
authored
Merge branch 'discord-jda:master' into master
2 parents 6b1b817 + 1dd8a7d commit 746a97f

38 files changed

Lines changed: 1035 additions & 428 deletions

build.gradle.kts

Lines changed: 4 additions & 5 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.3")
50+
version = Version(major = "6", minor = "0", revision = "0", classifier = "rc.4")
5151
}
5252

5353
artifactFilters {
@@ -434,10 +434,9 @@ fun MavenPom.populate() {
434434
}
435435
}
436436

437-
// Skip fat jar publication (See https://github.com/johnrengelman/shadow/issues/586)
438-
components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElements.get()) { skip() }
439-
val SoftwareComponentContainer.java
440-
get() = components.getByName<AdhocComponentWithVariants>("java")
437+
shadow {
438+
addShadowVariantIntoJavaComponent = false
439+
}
441440

442441
val stagingDirectory = layout.buildDirectory.dir("staging-deploy").get()
443442

gradle/libs.versions.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
[versions]
2-
jackson = "2.19.1"
2+
jackson = "2.20.0"
33

44
[libraries]
55
archunit = "com.tngtech.archunit:archunit:1.4.1"
6-
assertj = "org.assertj:assertj-core:3.27.3"
6+
assertj = "org.assertj:assertj-core:3.27.4"
77
commons-collections = "org.apache.commons:commons-collections4:4.5.0"
88
commons-lang3 = "org.apache.commons:commons-lang3:3.18.0"
99
findbugs = "com.google.code.findbugs:jsr305:3.0.2"
1010
jackson-core = { module = "com.fasterxml.jackson.core:jackson-core", version.ref = "jackson" }
1111
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
1212
jetbrains-annotations = "org.jetbrains:annotations:26.0.2"
1313
jna = "net.java.dev.jna:jna:5.17.0"
14-
junit = "org.junit.jupiter:junit-jupiter:5.13.3"
15-
junit-launcher = "org.junit.platform:junit-platform-launcher:1.13.3"
14+
junit = "org.junit.jupiter:junit-jupiter:5.13.4"
15+
junit-launcher = "org.junit.platform:junit-platform-launcher:1.13.4"
1616
logback-classic = "ch.qos.logback:logback-classic:1.5.18"
17-
mockito = "org.mockito:mockito-core:5.18.0"
17+
mockito = "org.mockito:mockito-core:5.19.0"
1818
okhttp = "com.squareup.okhttp3:okhttp-jvm:5.1.0"
1919
opus = "club.minnced:opus-java:1.1.1"
2020
reflections = "org.reflections:reflections:0.10.2"
@@ -34,8 +34,8 @@ junit = [
3434
]
3535

3636
[plugins]
37-
shadow = "com.gradleup.shadow:8.3.8"
37+
download = "de.undercouch.download:5.6.0"
38+
jreleaser = "org.jreleaser:1.20.0"
39+
shadow = "com.gradleup.shadow:9.1.0"
3840
version-catalog-update = "nl.littlerobots.version-catalog-update:1.0.0"
3941
versions = "com.github.ben-manes.versions:0.52.0"
40-
jreleaser = "org.jreleaser:1.19.0"
41-
download = "de.undercouch.download:5.6.0"

jitpack.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
jdk:
2+
- openjdk17

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

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,70 +16,18 @@
1616

1717
package net.dv8tion.jda.api.components;
1818

19-
import net.dv8tion.jda.annotations.ForRemoval;
20-
import net.dv8tion.jda.annotations.ReplaceWith;
19+
import net.dv8tion.jda.api.components.attribute.ICustomId;
2120
import net.dv8tion.jda.api.components.attribute.IDisableable;
22-
import net.dv8tion.jda.api.components.replacer.ComponentReplacer;
23-
import net.dv8tion.jda.api.components.replacer.IReplaceable;
24-
import net.dv8tion.jda.api.components.tree.ComponentTree;
2521
import net.dv8tion.jda.api.interactions.components.ComponentInteraction;
2622

2723
import javax.annotation.CheckReturnValue;
2824
import javax.annotation.Nonnull;
29-
import javax.annotation.Nullable;
3025

3126
/**
3227
* Component which supports interactions via {@link ComponentInteraction}.
3328
*/
34-
public interface ActionComponent extends IDisableable
29+
public interface ActionComponent extends IDisableable, ICustomId
3530
{
36-
/**
37-
* An unique component ID or {@code null}.
38-
* <br>Some components such as link buttons don't have this.
39-
*
40-
* <p>Custom IDs can contain custom data,
41-
* this is typically used to pass data between a slash command and your button listener.
42-
*
43-
* <p>While this ID is unique and can be retrieved with {@link ComponentInteraction#getComponentId()},
44-
* you should use {@link #getUniqueId()} to identify a component in a single message,
45-
* such as when replacing components using {@link ComponentTree} or {@link IReplaceable#replace(ComponentReplacer)}.
46-
*
47-
* @return The component ID or null if not present
48-
*
49-
* @see ComponentInteraction#getComponentId()
50-
* @see Component#getUniqueId()
51-
*
52-
* @deprecated
53-
* Replaced with {@link #getCustomId()}
54-
*/
55-
@Nullable
56-
@Deprecated
57-
@ForRemoval
58-
@ReplaceWith("getCustomId()")
59-
default String getId()
60-
{
61-
return getCustomId();
62-
}
63-
64-
/**
65-
* An unique component ID or {@code null}.
66-
* <br>Some components such as link buttons don't have this.
67-
*
68-
* <p>Custom IDs can contain custom data,
69-
* this is typically used to pass data between a slash command and your button listener.
70-
*
71-
* <p>While this ID is unique and can be retrieved with {@link ComponentInteraction#getComponentId()},
72-
* you should use {@link #getUniqueId()} to identify a component in a single message,
73-
* such as when replacing components using {@link ComponentTree} or {@link IReplaceable#replace(ComponentReplacer)}.
74-
*
75-
* @return The component ID or null if not present
76-
*
77-
* @see ComponentInteraction#getComponentId()
78-
* @see Component#getUniqueId()
79-
*/
80-
@Nullable
81-
String getCustomId();
82-
8331
@Nonnull
8432
@Override
8533
ActionComponent withUniqueId(int uniqueId);
@@ -105,7 +53,6 @@ default ActionComponent asDisabled()
10553
return (ActionComponent) IDisableable.super.asDisabled();
10654
}
10755

108-
10956
/**
11057
* Returns a copy of this component with {@link #isDisabled()} set to false.
11158
*

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ enum Type
114114
{
115115
UNKNOWN(-1, false, false),
116116
/** A row of components */
117-
ACTION_ROW(1, true, true),
117+
ACTION_ROW(1, true, false),
118118
/** A button */
119119
BUTTON(2, true, false),
120120
/** A select menu of strings */
121-
STRING_SELECT(3, true, false),
121+
STRING_SELECT(3, true, true),
122122
/** A text input field */
123123
TEXT_INPUT(4, false, true),
124124
/** A select menu of users */
@@ -136,6 +136,7 @@ enum Type
136136
FILE_DISPLAY(13, true, false),
137137
SEPARATOR(14, true, false),
138138
CONTAINER(17, true, false),
139+
LABEL(18, false, true),
139140
;
140141

141142
private final int key;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import net.dv8tion.jda.internal.components.buttons.ButtonImpl;
2727
import net.dv8tion.jda.internal.components.container.ContainerImpl;
2828
import net.dv8tion.jda.internal.components.filedisplay.FileDisplayImpl;
29+
import net.dv8tion.jda.internal.components.label.LabelImpl;
2930
import net.dv8tion.jda.internal.components.mediagallery.MediaGalleryImpl;
3031
import net.dv8tion.jda.internal.components.section.SectionImpl;
3132
import net.dv8tion.jda.internal.components.selections.EntitySelectMenuImpl;
@@ -101,6 +102,8 @@ private static IComponentUnion parseComponent(@Nonnull DataObject data)
101102
return new SeparatorImpl(data);
102103
case CONTAINER:
103104
return new ContainerImpl(data);
105+
case LABEL:
106+
return new LabelImpl(data);
104107
default:
105108
return new UnknownComponentImpl(data);
106109
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616

1717
package net.dv8tion.jda.api.components;
1818

19-
import net.dv8tion.jda.api.components.actionrow.ActionRow;
20-
2119
import javax.annotation.Nonnull;
2220

2321
/**
2422
* Represents a component that can be added directly to a modal, this includes:
2523
* <ul>
26-
* <li>{@link ActionRow}</li>
24+
* <li>{@link net.dv8tion.jda.api.components.label.Label Label}</li>
2725
* </ul>
2826
*/
2927
public interface ModalTopLevelComponent extends Component

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,40 @@
1616

1717
package net.dv8tion.jda.api.components;
1818

19-
import net.dv8tion.jda.api.components.actionrow.ActionRow;
19+
import net.dv8tion.jda.api.components.label.Label;
2020

2121
import javax.annotation.Nonnull;
2222

2323
/**
2424
* Represents a union of {@link ModalTopLevelComponent ModalTopLevelComponents} that can be one of:
2525
* <ul>
26-
* <li>{@link ActionRow}</li>
26+
* <li>{@link Label}</li>
2727
* <li>{@link UnknownComponent}, detectable via {@link #isUnknownComponent()}</li>
2828
* </ul>
2929
*/
3030
public interface ModalTopLevelComponentUnion extends ModalTopLevelComponent, IComponentUnion
3131
{
3232
/**
33-
* Casts this union to a {@link ActionRow}.
33+
* Casts this union to a {@link Label}.
3434
* This method exists for developer discoverability.
3535
*
3636
* <p>Note: This is effectively equivalent to using the cast operator:
3737
* <pre><code>
3838
* //These are the same!
39-
* ActionRow row = union.asActionRow();
40-
* ActionRow row2 = (ActionRow) union;
39+
* Label label = union.asLabel();
40+
* Label label2 = (Label) union;
4141
* </code></pre>
4242
*
43-
* You can use {@link #getType()} to see if the component is of type {@link Component.Type#ACTION_ROW} to validate
44-
* whether you can call this method in addition to normal instanceof checks: <code>component instanceof ActionRow</code>
43+
* You can use {@link #getType()} to see if the component is of type {@link net.dv8tion.jda.api.components.Component.Type#LABEL LABEL} to validate
44+
* whether you can call this method in addition to normal instanceof checks: <code>component instanceof Label</code>
4545
*
4646
* @throws IllegalStateException
47-
* If the component represented by this union is not actually a {@link ActionRow}.
47+
* If the component represented by this union is not actually a {@link Label}.
4848
*
49-
* @return The component as a {@link ActionRow}
49+
* @return The component as a {@link Label}
5050
*/
5151
@Nonnull
52-
ActionRow asActionRow();
52+
Label asLabel();
5353

5454
@Nonnull
5555
@Override

src/main/java/net/dv8tion/jda/api/components/actionrow/ActionRow.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import net.dv8tion.jda.api.components.ActionComponent;
2020
import net.dv8tion.jda.api.components.Component;
2121
import net.dv8tion.jda.api.components.MessageTopLevelComponent;
22-
import net.dv8tion.jda.api.components.ModalTopLevelComponent;
2322
import net.dv8tion.jda.api.components.attribute.IDisableable;
2423
import net.dv8tion.jda.api.components.buttons.Button;
2524
import net.dv8tion.jda.api.components.container.ContainerChildComponent;
@@ -40,7 +39,7 @@
4039
*
4140
* @see ActionRowChildComponent
4241
*/
43-
public interface ActionRow extends MessageTopLevelComponent, ModalTopLevelComponent, ContainerChildComponent, IReplaceable, IDisableable
42+
public interface ActionRow extends MessageTopLevelComponent, ContainerChildComponent, IReplaceable, IDisableable
4443
{
4544
/**
4645
* Create one row of {@link ActionRowChildComponent components}.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package net.dv8tion.jda.api.components.attribute;
18+
19+
import net.dv8tion.jda.annotations.ForRemoval;
20+
import net.dv8tion.jda.annotations.ReplaceWith;
21+
import net.dv8tion.jda.api.components.Component;
22+
import net.dv8tion.jda.api.components.replacer.ComponentReplacer;
23+
import net.dv8tion.jda.api.components.replacer.IReplaceable;
24+
import net.dv8tion.jda.api.components.tree.ComponentTree;
25+
import net.dv8tion.jda.api.interactions.components.ComponentInteraction;
26+
27+
import javax.annotation.Nonnull;
28+
import javax.annotation.Nullable;
29+
30+
/**
31+
* Component which has an associated custom id.
32+
*/
33+
public interface ICustomId extends Component
34+
{
35+
/**
36+
* An unique component ID or {@code null}.
37+
* <br>Some components such as link buttons don't have this.
38+
*
39+
* <p>Custom IDs can contain custom data,
40+
* this is typically used to pass data between a slash command and your button listener.
41+
*
42+
* <p>While this ID is unique and can be retrieved with {@link ComponentInteraction#getComponentId()},
43+
* you should use {@link #getUniqueId()} to identify a component in a single message,
44+
* such as when replacing components using {@link ComponentTree} or {@link IReplaceable#replace(ComponentReplacer)}.
45+
*
46+
* @return The component ID or null if not present
47+
*
48+
* @see ComponentInteraction#getComponentId()
49+
* @see Component#getUniqueId()
50+
*
51+
* @deprecated
52+
* Replaced with {@link #getCustomId()}
53+
*/
54+
@Nullable
55+
@Deprecated
56+
@ForRemoval
57+
@ReplaceWith("getCustomId()")
58+
default String getId()
59+
{
60+
return getCustomId();
61+
}
62+
63+
/**
64+
* An unique component ID or {@code null}.
65+
* <br>Some components such as link buttons don't have this.
66+
*
67+
* <p>Custom IDs can contain custom data,
68+
* this is typically used to pass data between a slash command and your button listener.
69+
*
70+
* <p>While this ID is unique and can be retrieved with {@link ComponentInteraction#getComponentId()},
71+
* you should use {@link #getUniqueId()} to identify a component in a single message,
72+
* such as when replacing components using {@link ComponentTree} or {@link IReplaceable#replace(ComponentReplacer)}.
73+
*
74+
* @return The component ID or null if not present
75+
*
76+
* @see ComponentInteraction#getComponentId()
77+
* @see Component#getUniqueId()
78+
*/
79+
@Nullable
80+
String getCustomId();
81+
82+
@Nonnull
83+
@Override
84+
ICustomId withUniqueId(int uniqueId);
85+
}

0 commit comments

Comments
 (0)