Error Responses
The default approach Kord Extensions takes when displaying errors to users is to send the message directly to the user,
unformatted and without mentions/pings.
The errorResponse { } builder allows you to change how Kord Extensions formats and displays errors to users on
Discord.
Remember that by using the errorResponse { } builder, you're replacing the builder Kord Extensions provides by
default.
Make sure your builder always adds to the message and never results in an empty message, otherwise your bot may throw
strange, cryptic errors in some situations.
ExtensibleBot(TOKEN) {
// ...
errorResponse { message, type ->
allowedMentions { } // Disable mentions/pings.
embed {
title = "Oopsie Woopsie!"
color = DISCORD_FUCHSIA
description = message.translate()
}
}
}
Builders
Replace the error response builder, allowing you to add extra formatting to error messages.
The error message to be sent to users.
Call message.translate() to get the corresponding String.
Object representing what actually went wrong. This is a sealed type, so you can check whether it's an instance of one of its subtypes.