Package dev.sympho.modular_commands.impl
Record Class CommandImpl<H extends Handlers>
java.lang.Object
java.lang.Record
dev.sympho.modular_commands.impl.CommandImpl<H>
- Type Parameters:
H- The handler type.- Record Components:
scope- The scope that the command is defined in.callable- If the command may be directly invoked by users.parent- The parent of the command.name- The name of the command.aliases- The aliases that may also invoke the command.displayName- The display name of the command.description- The description of the command.parameters- The command parameters, in the order that they should be provided by the user.requiredGroup- The group that a user must have access for in order to invoke this command.skipGroupCheckOnInteraction- Whether group access checking should be skipped.requireParentGroups- Whether a user invoking this command must also have access to the groups necessary to invoke its parent command(s).nsfw- Whether this command can only be invoked in a NSFW channel.privateReply- Whether this command's response is sent in a way that only the invoking user can see.ephemeralReply- The type of ephemeral response to use, if any.inheritSettings- Whether the command settings should be inherited from the parent command (ignoring the values provided by this command).invokeParent- Whether to invoke the parent as part of normal execution.handlers- The handler to use for processing an invocation of the command.
- All Implemented Interfaces:
Command<H>
public record CommandImpl<H extends Handlers>(Command.Scope scope, boolean callable, Invocation parent, @MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String name, Set<@MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String> aliases, @MatchesRegex("(?U)^[ -_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String displayName, @MatchesRegex("(?Us)^.{1,100}+$") String description, List<Parameter<?>> parameters, Group requiredGroup, boolean skipGroupCheckOnInteraction, boolean requireParentGroups, boolean nsfw, boolean privateReply, ReplyManager.EphemeralType ephemeralReply, boolean inheritSettings, boolean invokeParent, H extends Handlers handlers)
extends Record
implements Command<H>
Default implementation of an interaction-based command.
- Since:
- 1.0
- Version:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.api.command.Command
Command.Scope -
Field Summary
Fields inherited from interface dev.sympho.modular_commands.api.command.Command
DESCRIPTION_REGEX, DISPLAY_NAME_REGEX, NAME_REGEX -
Constructor Summary
ConstructorsConstructorDescriptionCommandImpl(Command.Scope scope, boolean callable, Invocation parent, @MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String name, Set<@MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String> aliases, @MatchesRegex("(?U)^[ -_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String displayName, @MatchesRegex("(?Us)^.{1,100}+$") String description, List<Parameter<?>> parameters, Group requiredGroup, boolean skipGroupCheckOnInteraction, boolean requireParentGroups, boolean nsfw, boolean privateReply, ReplyManager.EphemeralType ephemeralReply, boolean inheritSettings, boolean invokeParent, H handlers) Initializes a new instance. -
Method Summary
Modifier and TypeMethodDescriptionSet<@MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String>aliases()Returns the value of thealiasesrecord component.booleancallable()Returns the value of thecallablerecord component.@MatchesRegex("(?Us)^.{1,100}+$") StringReturns the value of thedescriptionrecord component.@MatchesRegex("(?U)^[ -_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") StringReturns the value of thedisplayNamerecord component.Returns the value of theephemeralReplyrecord component.final booleanIndicates whether some other object is "equal to" this one.handlers()Returns the value of thehandlersrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theinheritSettingsrecord component.booleanReturns the value of theinvokeParentrecord component.@MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") Stringname()Returns the value of thenamerecord component.booleannsfw()Returns the value of thensfwrecord component.Returns the value of theparametersrecord component.parent()Returns the value of theparentrecord component.booleanReturns the value of theprivateReplyrecord component.Returns the value of therequiredGrouprecord component.booleanReturns the value of therequireParentGroupsrecord component.scope()Returns the value of thescoperecord component.booleanReturns the value of theskipGroupCheckOnInteractionrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.sympho.modular_commands.api.command.Command
aliasInvocations, invocation
-
Constructor Details
-
CommandImpl
@SideEffectFree public CommandImpl(Command.Scope scope, boolean callable, Invocation parent, @MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String name, Set<@MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String> aliases, @MatchesRegex("(?U)^[ -_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") String displayName, @MatchesRegex("(?Us)^.{1,100}+$") String description, List<Parameter<?>> parameters, Group requiredGroup, boolean skipGroupCheckOnInteraction, boolean requireParentGroups, boolean nsfw, boolean privateReply, ReplyManager.EphemeralType ephemeralReply, boolean inheritSettings, boolean invokeParent, H handlers) Initializes a new instance.- Parameters:
scope- The scope that the command is defined in.callable- If the command may be directly invoked by users.parent- The parent of the command.name- The name of the command.aliases- The aliases that may also invoke the command.displayName- The display name of the command.description- The description of the command.parameters- The command parameters, in the order that they should be provided by the user.requiredGroup- The group that a user must have access for in order to invoke this command.skipGroupCheckOnInteraction- Whether group access checking should be skipped.requireParentGroups- Whether a user invoking this command must also have access to the groups necessary to invoke its parent command(s).nsfw- Whether this command can only be invoked in a NSFW channel.privateReply- Whether this command's response is sent in a way that only the invoking user can see.ephemeralReply- The type of ephemeral response to use, if any.inheritSettings- Whether the command settings should be inherited from the parent command (ignoring the values provided by this command).invokeParent- Whether to invoke the parent as part of normal execution.handlers- The handler to use for processing an invocation of the command.
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
scope
Returns the value of thescoperecord component. -
callable
public boolean callable()Returns the value of thecallablerecord component. -
parent
Returns the value of theparentrecord component. -
name
Returns the value of thenamerecord component. -
aliases
Returns the value of thealiasesrecord component. -
displayName
Returns the value of thedisplayNamerecord component.- Specified by:
displayNamein interfaceCommand<H extends Handlers>- Returns:
- the value of the
displayNamerecord component
-
description
Returns the value of thedescriptionrecord component.- Specified by:
descriptionin interfaceCommand<H extends Handlers>- Returns:
- the value of the
descriptionrecord component
-
parameters
Returns the value of theparametersrecord component.- Specified by:
parametersin interfaceCommand<H extends Handlers>- Returns:
- the value of the
parametersrecord component
-
requiredGroup
Returns the value of therequiredGrouprecord component.- Specified by:
requiredGroupin interfaceCommand<H extends Handlers>- Returns:
- the value of the
requiredGrouprecord component
-
skipGroupCheckOnInteraction
public boolean skipGroupCheckOnInteraction()Returns the value of theskipGroupCheckOnInteractionrecord component.- Specified by:
skipGroupCheckOnInteractionin interfaceCommand<H extends Handlers>- Returns:
- the value of the
skipGroupCheckOnInteractionrecord component - See Also:
-
requireParentGroups
public boolean requireParentGroups()Returns the value of therequireParentGroupsrecord component.- Specified by:
requireParentGroupsin interfaceCommand<H extends Handlers>- Returns:
- the value of the
requireParentGroupsrecord component - See Also:
-
nsfw
public boolean nsfw()Returns the value of thensfwrecord component. -
privateReply
public boolean privateReply()Returns the value of theprivateReplyrecord component.- Specified by:
privateReplyin interfaceCommand<H extends Handlers>- Returns:
- the value of the
privateReplyrecord component
-
ephemeralReply
Returns the value of theephemeralReplyrecord component.- Specified by:
ephemeralReplyin interfaceCommand<H extends Handlers>- Returns:
- the value of the
ephemeralReplyrecord component
-
inheritSettings
public boolean inheritSettings()Returns the value of theinheritSettingsrecord component.- Specified by:
inheritSettingsin interfaceCommand<H extends Handlers>- Returns:
- the value of the
inheritSettingsrecord component
-
invokeParent
public boolean invokeParent()Returns the value of theinvokeParentrecord component.- Specified by:
invokeParentin interfaceCommand<H extends Handlers>- Returns:
- the value of the
invokeParentrecord component
-
handlers
Returns the value of thehandlersrecord component.
-