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.
.waitUntil()
c.waitUntil
= c.executionCtx.waitUntil
get: req
command, component, modal
Interaction Request are included as is.
get: interaction
command, component, modal
c.interaction
= JSON.parse(await c.req.text())
Please refer to the Official Docs.
get: sub
command
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: values
command modal
It contains the value of the command option.
In the case of a modal, it contains the string of the custom_id.
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.
.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.