Skip to content

register

register.ts
import { makeSlashCommand, makeStringOption, register } from 'discord-hono'
const commands = [
makeSlashCommand('ping', 'response pong'),
makeSlashCommand('image', 'response image file').options([
makeStringOption('text', 'with text').required(true),
]),
]
register(
commands,
process.env.DISCORD_APPLICATION_ID,
process.env.DISCORD_TOKEN,
//process.env.DISCORD_TEST_GUILD_ID,
)

When you specify the fourth argument, it registers a command to a single guild (server) immediately.
If you do not specify the fourth argument, it can be registered globally.

register(
[],
process.env.DISCORD_APPLICATION_ID,
process.env.DISCORD_TOKEN,
//process.env.DISCORD_TEST_GUILD_ID,
)