Struct twilight_command_parser::config::CommandParserConfig[][src]

pub struct CommandParserConfig<'a> { /* fields omitted */ }
👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Expand description

Configuration for a Parser.

Implementations

👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Creates a fresh default configuration with no commands or prefixes.

👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Returns an iterator of immutable references to the commands.

👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Returns an iterator of mutable references to the commands.

Use the add_command and remove_command methods for an easier way to manage commands.

👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Returns an iterator of immutable references to the prefixes.

Use the add_prefix and remove_prefix methods for an easier way to manage prefixes.

👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Returns an iterator of mutable references to the prefixes.

👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Add a command to the list of commands.

Examples

Add a case-sensitive “ping” command:

use twilight_command_parser::CommandParserConfig;

let mut config = CommandParserConfig::new();
config.add_command("ping", true);
assert_eq!(1, config.commands().len());
👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Removes a command from the list of commands.

Any commands that would match the command provided are removed.

Examples
use twilight_command_parser::CommandParserConfig;

let mut config = CommandParserConfig::new();
config.add_command("ping", true);
config.add_command("PING", false);
assert_eq!(2, config.commands().len());

// Now remove it and verify that there are no commands.
config.remove_command("ping");
assert_eq!(config.commands().len(), 0);
👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Adds a prefix to the list of prefixes.

Examples
use twilight_command_parser::CommandParserConfig;

let mut config = CommandParserConfig::new();
config.add_prefix("!");
assert_eq!(1, config.prefixes().len());
👎 Deprecated since 0.8.1:

use interactions via twilight-http or twilight-gateway

Removes a prefix from the list of prefixes.

Returns whether a prefix with the name was removed.

Examples
use twilight_command_parser::CommandParserConfig;

let mut config = CommandParserConfig::new();
config.add_prefix("!");
config.add_prefix("~");
assert_eq!(2, config.prefixes().len());

// Now remove one and verify that there is only 1 prefix.
config.remove_prefix("!");
assert_eq!(1, config.prefixes().len());

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.