Record Class DefaultErrorMessageFactory
java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.embeds.error.DefaultErrorMessageFactory
- All Implemented Interfaces:
ErrorMessageFactory
public record DefaultErrorMessageFactory(Embeds embeds)
extends Record
implements ErrorMessageFactory
The default implementation of
ErrorMessageFactory. Supports loading the embeds from an EmbedDataSource.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ErrorMessageFactory
ErrorMessageFactory.ErrorContext -
Constructor Summary
ConstructorsConstructorDescriptionDefaultErrorMessageFactory(Embeds embeds) Creates an instance of aDefaultErrorMessageFactoryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionembeds()Returns the value of theembedsrecord component.final booleanIndicates whether some other object is "equal to" this one.net.dv8tion.jda.api.utils.messages.MessageCreateDatagetCommandExecutionFailedMessage(ErrorMessageFactory.ErrorContext context, Throwable exception) Gets aMessageCreateDatato send when the command execution failed.net.dv8tion.jda.api.utils.messages.MessageCreateDatagetConstraintFailedMessage(ErrorMessageFactory.ErrorContext context, String message) Gets aMessageCreateDatato send when a parameter constraint fails.net.dv8tion.jda.api.utils.messages.MessageCreateDataGets aMessageCreateDatato send when a user is missing permissions.net.dv8tion.jda.api.utils.messages.MessageCreateDatagetTimedOutComponentMessage(net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event) Gets aMessageCreateDatato send when an incoming component interaction already timed out.net.dv8tion.jda.api.utils.messages.MessageCreateDatagetTypeAdaptingFailedMessage(ErrorMessageFactory.ErrorContext context, io.github.kaktushose.proteus.conversion.ConversionResult.Failure<?> failure) Gets aMessageCreateDatato send when type adapting of the user input failed.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DefaultErrorMessageFactory
Creates an instance of aDefaultErrorMessageFactoryrecord class.- Parameters:
embeds- the value for theembedsrecord component
-
-
Method Details
-
getTypeAdaptingFailedMessage
public net.dv8tion.jda.api.utils.messages.MessageCreateData getTypeAdaptingFailedMessage(ErrorMessageFactory.ErrorContext context, io.github.kaktushose.proteus.conversion.ConversionResult.Failure<?> failure) Gets aMessageCreateDatato send when type adapting of the user input failed. UseEmbedConfig.errorSource(EmbedDataSource)to replace the default embed of this error message. Alternatively, pass your ownErrorMessageFactoryimplementation toJDACBuilder.errorMessageFactory(ErrorMessageFactory).- Specified by:
getTypeAdaptingFailedMessagein interfaceErrorMessageFactory- Parameters:
context- theErrorMessageFactory.ErrorContextfailure- theConversionResult.Failure- Returns:
- a
MessageCreateDatato send when type adapting failed
-
getInsufficientPermissionsMessage
public net.dv8tion.jda.api.utils.messages.MessageCreateData getInsufficientPermissionsMessage(ErrorMessageFactory.ErrorContext context) Gets aMessageCreateDatato send when a user is missing permissions. UseEmbedConfig.errorSource(EmbedDataSource)to replace the default embed of this error message. Alternatively, pass your ownErrorMessageFactoryimplementation toJDACBuilder.errorMessageFactory(ErrorMessageFactory).- Specified by:
getInsufficientPermissionsMessagein interfaceErrorMessageFactory- Parameters:
context- theErrorMessageFactory.ErrorContext- Returns:
- a
MessageCreateDatato send when a user is missing permissions
-
getConstraintFailedMessage
public net.dv8tion.jda.api.utils.messages.MessageCreateData getConstraintFailedMessage(ErrorMessageFactory.ErrorContext context, String message) Gets aMessageCreateDatato send when a parameter constraint fails. UseEmbedConfig.errorSource(EmbedDataSource)to replace the default embed of this error message. Alternatively, pass your ownErrorMessageFactoryimplementation toJDACBuilder.errorMessageFactory(ErrorMessageFactory).- Specified by:
getConstraintFailedMessagein interfaceErrorMessageFactory- Parameters:
context- theErrorMessageFactory.ErrorContext- Returns:
- a
MessageCreateDatato send when a parameter constraint fails
-
getCommandExecutionFailedMessage
public net.dv8tion.jda.api.utils.messages.MessageCreateData getCommandExecutionFailedMessage(ErrorMessageFactory.ErrorContext context, Throwable exception) Gets aMessageCreateDatato send when the command execution failed. UseEmbedConfig.errorSource(EmbedDataSource)to replace the default embed of this error message. Alternatively, pass your ownErrorMessageFactoryimplementation toJDACBuilder.errorMessageFactory(ErrorMessageFactory).- Specified by:
getCommandExecutionFailedMessagein interfaceErrorMessageFactory- Parameters:
context- theErrorMessageFactory.ErrorContextexception- theThrowablethat made the command execution fail- Returns:
- a
MessageCreateDatato send when the command execution failed
-
getTimedOutComponentMessage
public net.dv8tion.jda.api.utils.messages.MessageCreateData getTimedOutComponentMessage(net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event) Gets aMessageCreateDatato send when an incoming component interaction already timed out. UseEmbedConfig.errorSource(EmbedDataSource)to replace the default embed of this error message. Alternatively, pass your ownErrorMessageFactoryimplementation toJDACBuilder.errorMessageFactory(ErrorMessageFactory).- Specified by:
getTimedOutComponentMessagein interfaceErrorMessageFactory- Parameters:
event- theGenericInteractionCreateEventmo runtime was found for- Returns:
- a
MessageCreateDatato send when an incoming component interaction already timed out
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
embeds
Returns the value of theembedsrecord component.- Returns:
- the value of the
embedsrecord component
-