v0.x
v0.20.0
Section titled “v0.20.0”Coding changes for rest query
Section titled “Coding changes for rest query”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)v0.19.0
Section titled “v0.19.0”Context integration
c.cronEvent -> c.interaction
Section titled “c.cronEvent -> c.interaction”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.18.0
Section titled “v0.18.0”Removed c.followupDelete
Section titled “Removed c.followupDelete”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())v0.17.0
Section titled “v0.17.0”Removed c.req, c.waitUntil()
Section titled “Removed c.req, c.waitUntil()”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")v0.16.6
Section titled “v0.16.6”Unintentional breaking change caused by a developer implementation mistake
fix: c.followup
Section titled “fix: c.followup”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.
v0.16.0
Section titled “v0.16.0”Rest -> createRest
Section titled “Rest -> createRest”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' })v0.15.0
Section titled “v0.15.0”factory.loader -> app.loader
Section titled “factory.loader -> app.loader”const app = factory.discord() factory.loader(app, Object.values(handlers)) .loader(Object.values(handlers))export default appv0.14.0
Section titled “v0.14.0”Return value of get method in Rest
Section titled “Return value of get method in Rest”const { result } = await c.rest.get('/applications/@me', [])const result = await c.rest.get('/applications/@me', []).then(r => r.json())v0.13.0
Section titled “v0.13.0”Unsupport regex keys
Section titled “Unsupport regex keys”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'))Type change for ComponentContext
Section titled “Type change for ComponentContext”const handler= (c: ComponentContext<Env, 'Button'>) => {const handler= (c: ComponentContext<Env, Button>) => { //...}v0.12.0
Section titled “v0.12.0”Context integration
Section titled “Context integration”const func = (c: CommandContext<Env> | ComponentContext<Env>) => { //... if (c instanceof CommandContext) if (c.interaction.type === 2) //...}