Class AttachmentArgument<O>
- java.lang.Object
-
- me.s3ns3iw00.jcommands.argument.Argument<O>
-
- me.s3ns3iw00.jcommands.argument.InputArgument<org.javacord.api.entity.Attachment,O>
-
- me.s3ns3iw00.jcommands.argument.type.AttachmentArgument<O>
-
public class AttachmentArgument<O> extends InputArgument<org.javacord.api.entity.Attachment,O>
An argument that only acceptsAttachment
input
-
-
Constructor Summary
Constructors Constructor Description AttachmentArgument(java.lang.String name, java.lang.String description, java.lang.Class<O> resultType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArgumentValidation<org.javacord.api.entity.Attachment>
whenAboveMaxSize(int maxSize)
Creates a size validation that limits maximum allowed size for the attachment in bytesArgumentValidation<org.javacord.api.entity.Attachment>
whenAboveMaxSizeInMB(double maxSizeInMB)
Creates a size validation that limits maximum allowed size for the attachment in megabytes
The size will be converted to bytes (multiplying by 1000 two times) and explicit converted to integer, therefore the maximum value could be 2147.483647ArgumentValidation<org.javacord.api.entity.Attachment>
whenInvalidExtension(java.util.Set<java.lang.String> validExtensions)
Creates an extension validation-
Methods inherited from class me.s3ns3iw00.jcommands.argument.InputArgument
convertResult, getArgumentValidator, getCommandOption, getResultConverter, getResultType, isOptional, setOptional
-
Methods inherited from class me.s3ns3iw00.jcommands.argument.Argument
getDescription, getMismatchListener, getName, getType, setOnMismatch
-
-
-
-
Constructor Detail
-
AttachmentArgument
public AttachmentArgument(java.lang.String name, java.lang.String description, java.lang.Class<O> resultType)
-
-
Method Detail
-
whenInvalidExtension
public ArgumentValidation<org.javacord.api.entity.Attachment> whenInvalidExtension(java.util.Set<java.lang.String> validExtensions)
Creates an extension validation- Parameters:
validExtensions
- the valid extensions- Returns:
- the
ArgumentValidation
to be able to specify a custom response withArgumentValidation.thenRespond(ArgumentMismatchEventListener)
-
whenAboveMaxSize
public ArgumentValidation<org.javacord.api.entity.Attachment> whenAboveMaxSize(int maxSize)
Creates a size validation that limits maximum allowed size for the attachment in bytes- Parameters:
maxSize
- the max size in bytes- Returns:
- the
ArgumentValidation
to be able to specify a custom response withArgumentValidation.thenRespond(ArgumentMismatchEventListener)
-
whenAboveMaxSizeInMB
public ArgumentValidation<org.javacord.api.entity.Attachment> whenAboveMaxSizeInMB(double maxSizeInMB)
Creates a size validation that limits maximum allowed size for the attachment in megabytes
The size will be converted to bytes (multiplying by 1000 two times) and explicit converted to integer, therefore the maximum value could be 2147.483647- Parameters:
maxSizeInMB
- the max size in megabytes- Returns:
- the
ArgumentValidation
to be able to specify a custom response withArgumentValidation.thenRespond(ArgumentMismatchEventListener)
-
-