@discommand/lite
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

discommand-lite

discommand, but Command Handler only

Installation

  • this is use for discord.js@14
  • Required by node.js 16.9.0 or higher
  1. Stable version
npm i @discommand/lite
  1. Development version
npm i @discommand/lite@next

Example

Usage for TypeScript

index.ts

import { CommandHandler, LoadType } from '@discommand/lite'
import { Client, GatewayIntentBits } from 'discord.js'

const client = new Client({
  intents: [GatewayIntentBits.Guilds],
})
const cmd = new CommandHandler(client, {
  loadType: LoadType.File,
  directory: __dirname + '/commands',
})

cmd.loadAll()
client.login('your_bot_token')

commands/ping.ts

import { Command } from '@discommand/lite'
import { ChatInputCommandInteraction } from 'discord.js'

export default class extends Command {
  name = 'ping'
  description = 'pong'
  execute(interaction: ChatInputCommandInteraction) {
    interaction.reply('Pong!')
  }
}

Usage for Javascript

index.js

const { CommandHandler, LoadType } = require('@discommand/lite')
const { Client, GatewayIntentBits } = require('discord.js')

const client = new Client({
  intents: [GatewayIntentBits.Guilds],
})
const cmd = new CommandHandler(client, {
  loadType: LoadType.File,
  directory: __dirname + 'commands',
})

cmd.loadAll()
client.login('your_bot_token')

commands/ping.js

const { Command } = require('@discommand/lite')

module.exports = class extends Command {
  name = 'ping'
  description = 'pong'
  execute(interaction) {
    interaction.reply('Pong!')
  }
}

Package Sidebar

Install

npm i @discommand/lite

Weekly Downloads

1

Version

1.4.0

License

MIT

Unpacked Size

9.99 kB

Total Files

5

Last publish

Collaborators

  • migan