sane-commands

0.0.2 • Public • Published

Purpose

This is the foundation of a small project focused on providing an alternative to something like commando for creating commands for your JS discord bot. In it's initial inception it should work with all libraries I'm familiar with. I plan on making it much more configurable when I get time.

It's still heavily WIP so don't look too closely 😅

Usage

handleCommands takes a list of arrays that contain an identifier and then as many piped commands as you like. Control flow for early cancellation mid-pipe is currently offered via a Maybe-like implementation that will probably be removed in the next iteration of the library.

const {handleCommands} = require('sane-commands')
const {prop, toUpper, drop} = require('ramda')
const discord = require('discord.js')
const client = new discord.Client()

const processCommands = handleCommands([
  ['!ping', (msg) => msg.reply('pong!')],
  ['!logYELL', prop('content'), drop(9), toUpper, console.log] // logs the input for the command in uppercase
])
client.on('message', processCommands)
client.login('token')

Package Sidebar

Install

npm i sane-commands

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

2.66 kB

Total Files

4

Last publish

Collaborators

  • matthewahiles