Skip to content

Discord.js

Builder

Discord.js builders can generate raw objects by doing .toJSON().
Discord Hono accepts raw objects, so use it.

The Command Builder and Embed Builder are supported by default without .toJSON().

Command Builder

import { SlashCommandBuilder } from '@discordjs/builders'
import { register } from 'discord-hono'
const commands = [
new SlashCommandBuilder()
.setName('ping')
.setDescription('Check if this interaction is responsive')
]
register(commands, ...)

Embed Builder

import { EmbedBuilder } from '@discordjs/builders'
import { DiscordHono } from 'discord-hono'
const app = new DiscordHono().command('embed', c =>
c.res({
embeds: [
new EmbedBuilder().setTitle('Title').setDescription('Description'),
],
}),
)