Record Class Component
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.dispatching.reply.Component
Represents a component, namely Button
, StringSelectMenu
or EntitySelectMenu
, that should be added to a reply.
Also holds the following two settings:
- enabled:
to enable or disable the component
- independent:
whether the component should be executed in the same Runtime
as the command it is bound to or not. If true
,
every component interaction will create a new Runtime
. Furthermore, the component cannot expire and will always
get executed, even after a bot restart.
Example:
@SlashCommand("example command")
public void onCommand(CommandEvent event) {
event.with().components(Components.of(true, false, "onButton")).reply();
}
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Component
Adds disabled, runtime-boundComponent
s to the reply.boolean
enabled()
Returns the value of theenabled
record component.static Component
Adds enabled, runtime-boundComponent
s to the reply.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theindependent
record component.static Component
independent
(String component) Adds enabled, runtime-independentComponent
s to the reply.name()
Returns the value of thename
record component.static Component
AddsComponent
s with the passed configuration to the reply.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Component
Creates an instance of aComponent
record class.- Parameters:
enabled
- the value for theenabled
record componentindependent
- the value for theindependent
record componentname
- the value for thename
record component
-
-
Method Details
-
enabled
-
disabled
-
independent
-
of
AddsComponent
s with the passed configuration to the reply. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
enabled
public boolean enabled()Returns the value of theenabled
record component.- Returns:
- the value of the
enabled
record component
-
independent
public boolean independent()Returns the value of theindependent
record component.- Returns:
- the value of the
independent
record component
-
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-