Record Class EntityRef.MessageRef
java.lang.Object
java.lang.Record
dev.sympho.modular_commands.utils.parse.entity.EntityRef.MessageRef
- Record Components:
id
- The message ID.channelId
- The ID of the channel that the role exists in.
public static record EntityRef.MessageRef(Snowflake id, Snowflake channelId)
extends Record
implements EntityRef<Message>
A reference to a message.
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.utils.parse.entity.EntityRef
EntityRef.ChannelRef<C extends @NonNull Channel>, EntityRef.MessageRef, EntityRef.RoleRef, EntityRef.UserRef
-
Constructor Summary
ConstructorsConstructorDescriptionMessageRef
(CommandContext context, Snowflake id) Creates a new instance when only the ID is specified.MessageRef
(Snowflake id, Snowflake channelId) Creates an instance of aMessageRef
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thechannelId
record component.final boolean
Indicates whether some other object is "equal to" this one.get
(GatewayDiscordClient client) Obtains the referenced entity.final int
hashCode()
Returns a hash code value for this object.id()
Returns the value of theid
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
MessageRef
Creates a new instance when only the ID is specified.- Parameters:
context
- The execution context.id
- The role ID.- Implementation Requirements:
- Other values default to where the command was invoked in.
-
MessageRef
Creates an instance of aMessageRef
record class.
-
-
Method Details
-
get
Description copied from interface:EntityRef
Obtains the referenced entity.- Specified by:
get
in interfaceEntityRef<Message>
- Parameters:
client
- The client to use to connect to Discord.- Returns:
- The entity. May be empty if there is no entity that matches the reference, and
may fail with a
InvalidArgumentException
if an entity exists but there is a mismatch.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
id
Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
channelId
Returns the value of thechannelId
record component.- Returns:
- the value of the
channelId
record component
-