Skip to content
This repository was archived by the owner on Jan 30, 2022. It is now read-only.

discommand/discommand-slash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!')
  }
}

About

easy discord.js slashCommand.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •