From 45d72eff173d87b1353d8b5d001775cc49129dab Mon Sep 17 00:00:00 2001 From: acdenisSK Date: Sun, 20 Aug 2017 23:02:38 +0200 Subject: Revamp the args to an `Args` struct Fixes #142 --- src/framework/standard/command.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/framework/standard/command.rs') diff --git a/src/framework/standard/command.rs b/src/framework/standard/command.rs index 01c4c5e..d8c2321 100644 --- a/src/framework/standard/command.rs +++ b/src/framework/standard/command.rs @@ -1,15 +1,15 @@ use std::sync::Arc; -use super::Configuration; +use super::{Configuration, Args}; use client::Context; use model::{Message, Permissions}; use std::collections::HashMap; -pub type Check = Fn(&mut Context, &Message, &[String], &Arc) -> bool + 'static; -pub type Exec = Fn(&mut Context, &Message, Vec, String) -> Result<(), String> + 'static; +pub type Check = Fn(&mut Context, &Message, &mut Args, &Arc) -> bool + 'static; +pub type Exec = Fn(&mut Context, &Message, Args) -> Result<(), String> + 'static; pub type Help = Fn(&mut Context, &Message, HashMap>, - &[String]) + Args) -> Result<(), String> + 'static; pub type BeforeHook = Fn(&mut Context, &Message, &str) -> bool + 'static; @@ -51,8 +51,6 @@ pub struct Command { pub example: Option, /// Command usage schema, used by other commands. pub usage: Option, - /// Whether arguments should be parsed using quote parser or not. - pub use_quotes: bool, /// Minumum amount of arguments that should be passed. pub min_args: Option, /// Maximum amount of arguments that can be passed. @@ -72,7 +70,7 @@ pub struct Command { impl Command { pub fn new(f: F) -> Self - where F: Fn(&mut Context, &Message, Vec, String) -> Result<(), String> + 'static { + where F: Fn(&mut Context, &Message, Args) -> Result<(), String> + 'static { Command { aliases: Vec::new(), checks: Vec::default(), @@ -80,7 +78,6 @@ impl Command { desc: None, usage: None, example: None, - use_quotes: false, dm_only: false, bucket: None, guild_only: false, -- cgit v1.2.3