aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/quote/mod.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2019-10-31 03:29:11 +0100
committerJokler <jokler.contact@gmail.com>2019-10-31 03:29:11 +0100
commit7d5fe78202b73ced8df7e897b95cf059daed6696 (patch)
tree3ba3c961b7919cb4e2ff4a21204e8c24cabb68d4 /src/plugins/quote/mod.rs
parent4a59dce1cdd371c86d1b4453bb5884d9344442d8 (diff)
downloadfrippy-7d5fe78202b73ced8df7e897b95cf059daed6696.tar.gz
frippy-7d5fe78202b73ced8df7e897b95cf059daed6696.zip
Quote: Actually fix info message
Diffstat (limited to 'src/plugins/quote/mod.rs')
-rw-r--r--src/plugins/quote/mod.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/plugins/quote/mod.rs b/src/plugins/quote/mod.rs
index 9b7e6f5..4f7827b 100644
--- a/src/plugins/quote/mod.rs
+++ b/src/plugins/quote/mod.rs
@@ -97,10 +97,7 @@ impl<T: Database, C: Client> Quote<T, C> {
thread_rng().gen_range(1, count + 1)
} else {
let idx_string = &command.tokens[1];
- let idx = match i32::from_str(idx_string) {
- Ok(i) => i,
- Err(_) => Err(ErrorKind::InvalidIndex)?,
- };
+ let idx = i32::from_str(idx_string).context(ErrorKind::InvalidIndex)?;
if idx < 0 {
count + idx + 1
@@ -150,7 +147,7 @@ impl<T: Database, C: Client> Quote<T, C> {
Ok(match count {
0 => Err(ErrorKind::NotFound)?,
1 => format!("1 quote was saved in {}", channel),
- _ => format!("{} quotes were saved in {}", channel, count),
+ _ => format!("{} quotes were saved in {}", count, channel),
})
}
1 => {
@@ -161,7 +158,7 @@ impl<T: Database, C: Client> Quote<T, C> {
Ok(match count {
0 => Err(ErrorKind::NotFound)?,
1 => format!("{} has 1 quote", quotee),
- _ => format!("{} has {} quotes", count, quotee),
+ _ => format!("{} has {} quotes", quotee, count),
})
}
_ => {