aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/quote/mod.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/quote/mod.rs b/src/plugins/quote/mod.rs
index 893b3e6..7223b42 100644
--- a/src/plugins/quote/mod.rs
+++ b/src/plugins/quote/mod.rs
@@ -96,12 +96,17 @@ impl<T: Database, C: Client> Quote<T, C> {
}
fn get(&self, command: &PluginCommand) -> Result<String, QuoteError> {
- let quotee = &command.tokens.get(0);
+ let tokens = command
+ .tokens
+ .iter()
+ .filter(|t| !t.is_empty())
+ .collect::<Vec<_>>();
+ let quotee = &tokens.get(0);
let channel = &command.target;
match quotee {
Some(quotee) => {
- let idx = match command.tokens.get(1) {
+ let idx = match tokens.get(1) {
Some(s) => Some(i32::from_str(s).context(ErrorKind::InvalidIndex)?),
None => None,
};