コンテンツにスキップ

Discord.js

ビルダー

Discord.js の各ビルダーは .toJSON() をすることで、生のオブジェクトを生成できます。
Discord Hono では、生のオブジェクトを受け入れているため、これを利用してください。

コマンドビルダーと Embed ビルダーは .toJSON() をしなくても、デフォルトで対応しています。

コマンドビルダー

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 ビルダー

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