aboutsummaryrefslogtreecommitdiff
path: root/src/hooks
diff options
context:
space:
mode:
authorLorenz Leitner <lrnz.ltnr@gmail.com>2021-10-11 15:49:06 +0200
committerLorenz Leitner <lrnz.ltnr@gmail.com>2021-10-12 12:06:57 +0200
commit20c9cedd0da622503b60e9607b6d1b1f10e2f41f (patch)
tree1a1b7cb526552c2ea94770c2ca7d87a0f5bb2ab0 /src/hooks
parentFix content retrieval from IRC message (diff)
Fix empty input
Diffstat (limited to '')
-rw-r--r--src/hooks/wa.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hooks/wa.rs b/src/hooks/wa.rs
index f9f5b94..d676495 100644
--- a/src/hooks/wa.rs
+++ b/src/hooks/wa.rs
@@ -110,10 +110,11 @@ async fn wa_query(
pub async fn wa(bot: &crate::Bot, msg: Message) -> Result<()> {
privmsg!(msg, {
- let content = text.chars().as_str().splitn(2, " ").collect::<Vec<&str>>()[1];
- if content.is_empty() {
+ let input = text.chars().as_str().splitn(2, " ").collect::<Vec<&str>>();
+ if input.len() != 2 {
bail!("Empty input for WA query");
}
+ let content = input[1].trim();
bot.send_privmsg(
msg.response_target()
.context("failed to get response target")?,