Skip to content

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.

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.

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/builders is accepted in ctx.reply() and similar methods.
  • Modals: Every modal builder from @discordjs/builders is accepted in ctx.showModal().

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.

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);
// or
await ctx.deferUpdate(false);