Skip to content
Classcorev0.10.0

Notice

Base class for a user-facing refusal or a reported fault.

Throw a Notice to stop a handler and reply to the user. The framework catches it at the controller boundary and renders render, which always decides what the user sees. With report false that render is all that happens. With report true the framework also logs the fault and publishes it to the handledException bus. A raw, non-Notice throw shows the generic message.

abstract class Notice extends Error

Member visibility

Filter class members by access level.

constructor

Constructs a new instance of the Notice class

protected Notice(message: string, options?: ErrorOptions)

Showing members with Protected visibility and higher.

ephemeral

Whether the reply is ephemeral, seen only by the invoking user. Set it false for a refusal the whole channel should see.

public ephemeral: boolean

Default:true

report

Whether this denial is a reported fault. True also logs it and publishes it to the handledException bus. The user always sees render either way.

public report: boolean

Default:false

summary

A short one-line reason. When every arm of an or gate refuses and each one sets this, or throws a refusal listing them under You need to meet at least one of these:. Write a verb phrase that finishes that line, for example, "be the bot owner".

public summary?: string

render()

Builds what the user sees. Called fresh each time the denial is shown, so the builders are new and the bot color resolves at render time.

public abstract render(ctx: RenderContext): ReplyResponse