Skip to content

Releases: luisfun/discord-hono

v0.16.0

09 Feb 11:44
Compare
Choose a tag to compare

BREAKING CHANGE

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' })

New Features

rest types

Support for most REST APIs

Full Changelog: v0.15.1...v0.16.0

v0.15.0

05 Feb 06:35
Compare
Choose a tag to compare

BREAKING CHANGE

Remove factory.loader, use app.loader instead

const app = factory.discord()
- factory.loader(app, Object.values(handlers))
+ .loader(Object.values(handlers))
export default app

Full Changelog: v0.14.0...v0.15.0

v0.14.0

04 Feb 11:43
Compare
Choose a tag to compare

BREAKING CHANGE

Return value of the get method in Rest

-const { result } = await c.rest.get('/applications/@me', [])
+const result = await c.rest.get('/applications/@me', []).then(r => r.json())

Reasons:

  • Consistency with other methods
  • Reduction of bundle size

Full Changelog: v0.13.0...v0.14.0

v0.13.0

03 Feb 13:36
Compare
Choose a tag to compare

BREAKING CHANGE

Unsupport regex keys

const app = new DiscordHono()
- .command(/regex/, c => c.res('regex'))
+ .command('regex', c => c.res('regex'))

Reasons:

  • It is not appropriate to use regex keys with .command(), .autocomplete(), and .cron()
  • 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

ComponentContext Types

-const handler= (c: ComponentContext<Env, 'Button'>) => {
+const handler= (c: ComponentContext<Env, Button>) => {
  //...
}

Full Changelog: v0.12.2...v0.13.0

v0.12.0

01 Feb 03:41
Compare
Choose a tag to compare

BREAKING CHANGE

Context integration

const func = (c: CommandContext<Env> | ComponentContext<Env>) => {
  //...
- if (c instanceof CommandContext)
+ if (c.interaction.type === 2)
  //...
}

Full Changelog: v0.11.4...v0.12.0