Skip to content

BotConfig

BotConfig = object

Defined in: bot.ts:40

optional buttons?: Record<string, (c) => Response | Promise<Response>>

Defined in: bot.ts:49

Answers a click, keyed by the button id given to reply. An id such as page:2 runs the page handler with c.value set to '2'. c.update edits the message that holds the button. Pass { buttons: [] } to remove them. c.deferUpdate(work) keeps the message as it is and edits it with what work returns, for a click that takes longer than 3 seconds.


commands: (Command | ContextMenu)[]

Defined in: bot.ts:42

The commands, made with command or contextMenu().


optional cron?: Record<string, (c) => void | Promise<void>>

Defined in: bot.ts:69

Runs on a Cron Trigger, keyed by the cron expression from your Wrangler config. c.send posts a message to a channel with DISCORD_TOKEN, and returns an Error if Discord refuses.


optional gateway?: string

Defined in: bot.ts:59

The name of the Durable Object binding that holds the class from gateway(). Open the Worker URL once after the first deploy to start the connection. A GET request or any Cron Trigger starts it again if it is down.


optional modals?: Modal[]

Defined in: bot.ts:53

The modals the bot answers, made with modal.


optional onError?: ErrorHandler

Defined in: bot.ts:64

Gets errors from deferred work. If that work fails, the bot also edits the answer to “Something went wrong.” so it does not stay on “thinking…”.


optional selects?: Select<SelectType, unknown>[]

Defined in: bot.ts:51

The select menus the bot answers, made with select().