Class DefaultErrorMessageFactory

java.lang.Object
io.github.kaktushose.jdac.embeds.error.DefaultErrorMessageFactory
All Implemented Interfaces:
ErrorMessageFactory

public class DefaultErrorMessageFactory extends Object implements ErrorMessageFactory

The default implementation of ErrorMessageFactory using Components V2.

Localization

For simple localization of these error messages you can add a jdac_LOCALE.ftl file to the resources folder and provide the keys/ use the variables as listed below.

Type Adapting Failed

Keys

  • adapting-failed-title
  • adapting-failed-details
  • adapting-failed-message

Variables

  • command: The full command with parameter names, with the failed argument underlined, for instance: /example arg1 arg2
  • expected: The expected argument type
  • actual: The provided argument type
  • raw: The raw, textual user input
  • message: The error message of the type adapter

Insufficient Permissions

Keys

  • insufficient-permissions

Variables

  • interaction: The name of the interaction that failed
  • permissions: The permissions that are required

Constraint Failed

Keys

  • constraint-failed

Variables

  • message: The already localized error message of the failed constraint

Interaction Execution Failed

Keys

  • execution-failed-title
  • execution-failed-message

Variables

  • user: the user executing the interaction
  • interaction: the interaction type
  • timestamp: the current timestamp
  • exception: the name of the exception class

Unknown Interaction

Keys

  • unknown-interaction

Own Implementation

Alternatively, you can pass your own ErrorMessageFactory implementation to JDACBuilder.errorMessageFactory(ErrorMessageFactory).