twilight-command-parser
This crate has been deprecated. Please use Discord interactions via the
twilight-gateway
or twilight-http
crates.
twilight-command-parser
is a command parser for the twilight-rs
ecosystem.
Included is a mutable configuration that allows you to specify the command names and prefixes. The parser parses out commands matching an available command and prefix and provides the command arguments to you.
Examples
A simple parser for a bot with one prefix ("!"
) and two commands: "echo"
and "ping"
:
use ;
let mut config = new;
config.add_command;
config.add_command;
// Add the prefix `"!"`.
// (Use `CommandParserConfig::add_prefixes` to add multiple prefixes)
config.add_prefix;
let parser = new;
// Now pass a command to the parser
match parser.parse