1.0.1 • Published 5 years ago

discord-argument-flag-parser v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

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!