Discommand
easy discord.js commandHandler
Install / Use
/learn @discommand/DiscommandREADME
discommand
easy discord.js commandHandler
Installation
- alert! this is Pure ES Module.
- this is use for discord.js@14
- Required by node.js 16.9.0 or higher
- Stable version
npm i discommand
- Development version
npm i discommand@next
Example
Usage for TypeScript
index.ts
import { DiscommandClient } from 'discommand'
import { GatewayIntentBits } from 'discord.js'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
const client = new DiscommandClient(
{
intents: [GatewayIntentBits.Guilds],
},
{
directory: {
command: dirname(fileURLToPath(import.meta.url)) + '/commands',
},
}
)
client.login('your_bot_token')
commands/ping.ts
import { Command } from 'discommand'
import { ChatInputCommandInteraction, ApplicationCommandType } from 'discord.js'
export default class extends Command {
constructor() {
super({
name: 'ping',
description: 'Pong',
type: ApplicationCommandType.ChatInput,
})
}
execute(interaction: ChatInputCommandInteraction) {
interaction.reply('Pong!')
}
}
Usage for Javascript
index.js
import { DiscommandClient } from 'discommand'
import { GatewayIntentBits } from 'discord.js'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
const client = new DiscommandClient(
{
intents: [GatewayIntentBits.Guilds],
},
{
directory: {
command: dirname(fileURLToPath(import.meta.url)) + '/commands',
},
}
)
client.login('your_bot_token')
commands/ping.js
import { Command } from 'discommand'
import { ApplicationCommandType } from 'discord.js'
module.exports = class extends Command {
constructor() {
super({
name: 'ping',
description: 'Pong',
type: ApplicationCommandType.ChatInput,
})
}
execute(interaction) {
interaction.reply('Pong!')
}
}
Related Skills
node-connect
350.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
