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.
All Implemented Interfaces:
EntityRef<Message>
Enclosing interface:
EntityRef<E extends @NonNull Entity>

public static record EntityRef.MessageRef(Snowflake id, Snowflake channelId) extends Record implements EntityRef<Message>
A reference to a message.
Since:
1.0
  • Constructor Details

    • MessageRef

      public MessageRef(CommandContext context, Snowflake id)
      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

      public MessageRef(Snowflake id, Snowflake channelId)
      Creates an instance of a MessageRef record class.
      Parameters:
      id - the value for the id record component
      channelId - the value for the channelId record component
  • Method Details

    • get

      public Mono<Message> get(GatewayDiscordClient client)
      Description copied from interface: EntityRef
      Obtains the referenced entity.
      Specified by:
      get in interface EntityRef<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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public Snowflake id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • channelId

      public Snowflake channelId()
      Returns the value of the channelId record component.
      Returns:
      the value of the channelId record component