Context
Context can be received as the second argument of app.command()
, app.component()
, app.modal()
, app.cron()
.
.env .event .executionCtx .set() .get() .var
Please refer to here.
We try to make it as similar to Hono as possible.
Regarding .var
The following values are included by default.
c.var.OPTION_NAME
command option value (command, autocomplete)c.var.custom_id
value of custom_id (component, modal)c.var.TEXTINPUT_CUSTOM_ID
value of text input (modal)
.waitUntil()
c.waitUntil
= c.executionCtx.waitUntil
get: req
command, component, autocomplete, modal
Interaction Request are included as is.
get: key
Handler triggered string.
get: interaction
command, component, autocomplete, modal
c.interaction
= JSON.parse(await c.req.text())
Please refer to the Official Docs.
get: sub
command, autocomplete
The first argument of SubGroup
is in c.sub.group
.
The first argument of SubCommand
is in c.sub.command
.
c.sub.string = (c.sub.group ? c.sub.group + ' ' : '') + c.sub.command
get: focused
autocomplete
The optional object in focus.
get: cronEvent
cron
It has the event value of the scheduled() first argument.
.res()
command, component, modal
The argument is a string or APIInteractionResponseCallbackData.
.resDefer()
command, component, modal
If you don’t respond to a Discord interaction within 3 seconds, an error will occur.
When performing time-consuming tasks, it’s a good idea to use .resDefer()
and include the subsequent processing as an argument.
.resUpdate()
component
Overwrites a message that has already been sent.
The argument is a string or APIInteractionResponseCallbackData.
.resDeferUpdate()
component
Delay overwriting messages.
.resAutocomplete()
The argument is a Autocomplete instance or APICommandAutocompleteInteractionResponseCallbackData.
.resModal()
command, component
The argument is a Modal instance or APIModalInteractionResponseCallbackData.
.followup()
command, component, modal
.followup()
is used to update messages after Defer.
The first argument is a string or APIInteractionResponseCallbackData.
The second argument is FileData or FileData[].
FileData = { blob: Blob, name: ‘file.name’ }
.followupDelete()
command, component, modal
.ephemeral()
command, component, modal
Send a message that is only visible to the user who performed the interaction.