Skip to content

v0.x

GET methods are highly likely to be affected.

await c.rest(
'GET', _channels_$_messages,
[channel_id], { limit: 10 },
[channel_id, { limit: 10 }],
)
await c.rest('METHOD', 'PATH', ['PATH_VAR'], DATA_OBJ or QUERY_OBJ)
await c.rest('METHOD', 'PATH', ['PATH_VAR', QUERY_OBJ], DATA_OBJ)

Context integration

const app = new DiscordHono().cron("", async c => {
console.log(c.cronEvent)
console.log(c.interaction)
})

CronContext changed to type information only

Section titled “CronContext changed to type information only”

v0.17.0 -> v0.18.0

return c.update().resDefer(c.followupDelete)
return c.update().resDefer(c => c.followup())

Before v0.16.x -> v0.18.0

return c.resDeferUpdate(c.followupDelete)
return c.update().resDefer(c => c.followup())

Since c.req could be confused with Hono’s c.req, and because handling Request objects is not necessary for Discord Bots, it has been removed.
If you absolutely need this functionality, please consider using Hono middleware instead.
If you cannot find an alternative and require c.req, please create an issue.

c.waitUntil() has been removed as its functionality is included in c.resDefer(), and its usage frequency was low.
Instead, please use c.executionCtx.waitUntil().

c.waitUntil(/*process*/)
c.executionCtx.waitUntil(/*process*/)

c.resUpdate(), c.resDeferUpdate() -> c.update()

Section titled “c.resUpdate(), c.resDeferUpdate() -> c.update()”
return c.resUpdate("update text")
return c.update().res("update text")
return c.resDeferUpdate("update text")
return c.update().resDefer("update text")

c.suppressEmbeds(), c.ephemeral(), c.suppressNotifications() -> c.flags()

Section titled “c.suppressEmbeds(), c.ephemeral(), c.suppressNotifications() -> c.flags()”
return c.ephemeral().suppressNotifications().res("ephemeral text")
return c.flags("EPHEMERAL", "SUPPRESS_NOTIFICATIONS").res("ephemeral text")

Unintentional breaking change caused by a developer implementation mistake

In versions prior to v0.16.5, followups were handled via POST.
From v0.16.6 onwards, followups are handled via PATCH.
This is a breaking change only if you are intentionally calling followup multiple times.
In such cases, please use c.rest to create a new followup.

const rest = new Rest('token')
const rest = createRest('token')
const res = c.rest.post(_channels_$_messages, [channel_id], { content: 'this is rest' })
const res = c.rest('POST', _channels_$_messages, [channel_id], { content: 'this is rest' })
const app = factory.discord()
factory.loader(app, Object.values(handlers))
.loader(Object.values(handlers))
export default app
const { result } = await c.rest.get('/applications/@me', [])
const result = await c.rest.get('/applications/@me', []).then(r => r.json())

For .component() and .modal(), please use custom_id instead of regex keys.
If you absolutely need to use regex keys, please refer to this example.

const app = new DiscordHono()
.command(/regex/, c => c.res('regex'))
.command('regex', c => c.res('regex'))
const handler= (c: ComponentContext<Env, 'Button'>) => {
const handler= (c: ComponentContext<Env, Button>) => {
//...
}
const func = (c: CommandContext<Env> | ComponentContext<Env>) => {
//...
if (c instanceof CommandContext)
if (c.interaction.type === 2)
//...
}