discord-argument-flag-parser

1.0.1 • Public • Published

Simple command/argument/flag parser for Discord bots


(Based off of chat-arg-parser, but with my flag system)

Usage:

const parse = require('discord-argument-flag-parser');
const prefix = '!';

let message = '!say arguments are cool "Hello parser!" -y --flag --anotherflag:value "--somanyflags:are cool"'
let command_data = parse(prefix, message)
console.log(command_data.cmd) //-> "say"
console.log(command_data.args) //-> ["arguments", "are", "cool", "Hello parser!"]
console.log(command_data.flags) //-> {"y": true, "flag": true, "anotherflag": "value", "somanyflags": "are cool"}

Have fun!

Readme

Keywords

none

Package Sidebar

Install

npm i discord-argument-flag-parser

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

1.71 kB

Total Files

3

Last publish

Collaborators

  • consolio