v0.x
v0.20.0
Section titled “v0.20.0”rest query のコーディング変更
Section titled “rest query のコーディング変更”GET メソッドは影響する可能性が高いです。
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 の統合
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 を type 情報のみに変更
Section titled “CronContext を type 情報のみに変更”v0.18.0
Section titled “v0.18.0”c.followupDelete を削除
Section titled “c.followupDelete を削除”v0.17.0 -> v0.18.0
return c.update().resDefer(c.followupDelete)return c.update().resDefer(c => c.followup())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”c.req と c.waitUntil() を削除
Section titled “c.req と c.waitUntil() を削除”c.req は Hono の c.req と混同される可能性があり、また Discord Bot では Request オブジェクトを扱う必要がないため、削除されました。
もしこの機能がどうしても必要な場合は、代わりに Hono のミドルウェアを利用することを検討してください。
どうしても代替手段が見つからず、c.req が必要な場合は Issue を作成してください。
c.waitUntil() は、その機能が c.resDefer() に含まれており、使用頻度も低かったため削除されました。
代わりに 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”開発者の実装ミスによる意図しない破壊的変更
fix: c.followup
Section titled “fix: c.followup”v0.16.5以前のバージョンでは、followup は POST を通して処理されていました。
v0.16.6以降では、followup は PATCH を通して処理されます。
これは、意図的に複数回 followup を呼び出している場合にのみ互換性を崩す変更となります。
そのような場合は、新しい followup を作成するために c.rest を使用してください。
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”Restにおけるgetメソッドの戻り値
Section titled “Restにおけるgetメソッドの戻り値”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”正規表現キーをサポートしない
Section titled “正規表現キーをサポートしない”.component() および .modal() では、正規表現キーの代わりに custom_id を使用してください。
正規表現キーをどうしても使用する必要がある場合は、この例を参照してください。
const app = new DiscordHono() .command(/regex/, c => c.res('regex')) .command('regex', c => c.res('regex'))ComponentContext の型変更
Section titled “ComponentContext の型変更”const handler= (c: ComponentContext<Env, 'Button'>) => {const handler= (c: ComponentContext<Env, Button>) => { //...}v0.12.0
Section titled “v0.12.0”Context の統合
Section titled “Context の統合”const func = (c: CommandContext<Env> | ComponentContext<Env>) => { //... if (c instanceof CommandContext) if (c.interaction.type === 2) //...}