Most Important Discord.js Differences
Handling Discord interactions in Honocord differs not much from discord.js, but there are some key differences to be aware of:
No internal convinience classes for Discord objects
Section titled “No internal convinience classes for Discord objects”Honocord does not provide internal classes for Discord objects like User, Guild, Message, etc.
Instead, it provides raw interaction data as defined by the Discord API.
Most of the types are defined in the discord-api-types package, which Honocord depends on. This means you will often work with plain objects instead of class instances.
No built-in caching
Section titled “No built-in caching”It is definitly planned to add optional caching in the future, but currently Honocord does not cache any data due to it being designed for serverless environments like Cloudflare Workers.
Responding to interactions
Section titled “Responding to interactions”Replying
Section titled “Replying”Usually you need to provide the raw API callback data, instead of discord.js structures. However, there are a few exceptions where Honocord accepts builders from @discordjs/builders:
- Components: Every component builder from
@discordjs/buildersis accepted inctx.reply()and similar methods. - Modals: Every modal builder from
@discordjs/buildersis accepted inctx.showModal().
Force Ephemeral
Section titled “Force Ephemeral”For ctx.reply() and ctx.followUp(), you can force the message to be ephemeral by passing true as the second argument:
await ctx.reply("This is an ephemeral message", true);This was done because I got annoyed having to always set the ephemeral flag in the response data manually, which was very clunky.
Defering
Section titled “Defering”You can defer, but can’t pass flags at the moment. However you can set whether it should be ephemeral or not:
await ctx.deferReply(true);// orawait ctx.deferUpdate(false);