CommandNotFoundError
class in meocord/common Since 4.1.0
class CommandNotFoundError extends ErrorThe error raised for an interaction no handler matches, such as a button whose customId fits no pattern.
Catch it in a global filter to answer an expired or unknown control in your own words. Without one, the built-in fallback answers "Command not found!" and logs a warning naming the customId or command.
Examples
@Catch(CommandNotFoundError)
export class ExpiredControlFilter implements ExceptionFilter<CommandNotFoundError> {
async catch(_error: CommandNotFoundError, context: ExecutionContext) {
const interaction = context.getInteraction()
if (interaction?.isRepliable()) await respond(interaction).send({ content: 'That button has expired.', flags: MessageFlags.Ephemeral })
}
}Members
constructor
new CommandNotFoundError(message?: string)Parameters
| Name | Type | Description |
|---|---|---|
message? | string | What the error says, |
See also
- Catch
- Exception filters