This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

discommand-slash
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

discommand-slash

  • This package is no longer supported. Accordingly, please use the discommand 4.0.0 version.
  • discommand's SlashCommandHandler

Installation

this is for discord.js@13

npm i discommand-slash

dev

npm i discommand-slash@next

Example

Usage for TypeScript

index.ts

import { Client, Intents } from 'discord.js'
import { Slash } from 'discommand-slash'
import path = require('path')

const client = new Client({ intents: [Intents.FLAGS.GUILDS] })
const cmd = new Slash(client, {
  path: path.join(__dirname, '/commands'),
  loadType: 'FILE',
})

cmd.loadCommand()

client.login('your_bot_token')

commands/ping.ts

import { SlashCommand, Slash } from 'discommand-slash'
import { CommandInteraction } from 'discord.js'
import { SlashCommandBuilder } from '@discordjs/builders'

export = class extends SlashCommand {
  data = new SlashCommandBuilder().setName('ping').setDescription('Pong!')
  execute(interaction: CommandInteraction, slash: Slash) {
    interaction.reply('Pong!')
  }
}

Usage for Javascript

index.js

const { Client, Intents } = require('discord.js')
const { Slash } = require('discommand-slash')
const path = require('path')

const client = new Client({ intents: [Intents.FLAGS.GUILDS] })
const cmd = new Slash(client, {
  path: path.join(__dirname, '/commands'),
  loadType: 'FILE',
})

cmd.loadCommand()

client.login('your_bot_token')

commands/ping.js

const { SlashCommand } = require('discommand-slash')
const { SlashCommandBuilder } = require('@discordjs/builders')

module.exports = class extends SlashCommand {
  data = new SlashCommandBuilder().setName('ping').setDescription('Pong!')
  execute(interaction, slash) {
    interaction.reply('Pong!')
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i discommand-slash

Weekly Downloads

12

Version

3.0.1

License

MIT

Unpacked Size

12.4 kB

Total Files

23

Last publish

Collaborators

  • migan