SkillAgentSearch skills...

Discommand

easy discord.js commandHandler

Install / Use

/learn @discommand/Discommand
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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
  1. Stable version
npm i discommand
  1. 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

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated1y ago
Forks5

Languages

TypeScript

Security Score

77/100

Audited on Apr 7, 2025

No findings