Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

zekro-archive/discordjs-cmds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

~ discordjs-cmds ~

Simple-to-use command parser for discord.js

   


THIS VERSION IS DEPRECATED

Take a look at the new, rewrote version discordjs-cmds2.


npm install discordjs-cmds --save


Contents


Disclaimer

This project is currently in an early development phase, which means, that there could be some unidentified bugs. Also, there will be much more functions added and advanced later! Feel free to post issues or pull request if you noticed a bug or if you have improvement suggestions!


Usage

Implement the library, create your bot framework and create an instance of the CmdParser

const { Client } = require('discord.js')
const { CmdParser } = require('discordjs-cmds')

// Creating bot instance
const bot = new Client()
// Creating CmdParser  Instance
const cmd = new CmdParser(bot, "-")

// Login the bot instance with your discord token
bot.login(/*bot token*/)

Now, create some methods for commands somewhere

function cmd_say(msg, args) {
    msg.channel.send(args.join(' '))
}

function cmd_ping(msg, args) {
    msg.channel.send('Pong!')
}

// ...

Then, you can register your commands like following

cmd.register(cmd_say, "say", ["tell", "send"], "Send a message with the bot", "-say <msg>", cmd.type.CHAT, 1)
   .register(cmd_ping, "ping")

For permissions, you can register specific permission levels for specific roles

cmd.setPerms(["2134792837489213749", "2319480812347123431"], 1)
   .setPerms("8757023480239487232", 2)

If you want to react on some events the CmdParser event manager fires, use it like following

cmd.on('commandFailed', (errtype) => console.log(`Failed Command: ${errtype}`))

Default Commands

There are some default implemented commands:

help

Sends the user a list of commands via DM

help <invoke>

Get the help message of a registered command


Changelog

All changelogs (after version 0.3.0) you can find in the CHANGELOG.md.


To-Do

  • Add option + function to give guilds higher perm lvl
  • Method to register bot host with max perm lvl
  • Guild specific prefixes
  • Custom command types
  • Aliases
  • Permissions
  • Detailed help command

About

Simple command parser for discord.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published