BotConfig
BotConfig =
object
Defined in: bot.ts:40
Properties
Section titled “Properties”buttons?
Section titled “buttons?”
optionalbuttons?: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
Section titled “commands”commands: (
Command|ContextMenu)[]
Defined in: bot.ts:42
The commands, made with command or contextMenu().
optionalcron?: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.
gateway?
Section titled “gateway?”
optionalgateway?: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.
modals?
Section titled “modals?”
optionalmodals?:Modal[]
Defined in: bot.ts:53
The modals the bot answers, made with modal.
onError?
Section titled “onError?”
optionalonError?: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…”.
selects?
Section titled “selects?”
optionalselects?:Select<SelectType,unknown>[]
Defined in: bot.ts:51
The select menus the bot answers, made with select().