From 4286574b3bce4d55cd8149da516b0899fcbd8032 Mon Sep 17 00:00:00 2001 From: eta Date: Thu, 27 May 2021 00:38:58 +0100 Subject: feat(paroxysm): don't print error messages for question marks If someone sends a message containing just question marks / spaces, provided it has 2 question marks before it, paroxysm would attempt to fetch an entry for the remainder of the question marks, and usually fail. This fixes that oversight, and silences the "never heard of it" message in such cases. Joke entries created for such question mark cases will still fire, though. Change-Id: I44ef823a55c32869ab5f47ffc733ea566e23bb41 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3161 Tested-by: BuildkiteCI Reviewed-by: sterni Reviewed-by: grfn Reviewed-by: tazjin Reviewed-by: cynthia --- fun/paroxysm/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'fun') diff --git a/fun/paroxysm/src/main.rs b/fun/paroxysm/src/main.rs index 63863340eb68..e28fc779335a 100644 --- a/fun/paroxysm/src/main.rs +++ b/fun/paroxysm/src/main.rs @@ -301,8 +301,12 @@ impl App { } } None => { - self.client - .send_notice(target, format!("\x02{}\x0f: never heard of it", subj))?; + // If someone just posts "??????????", don't spam the channel with + // an error message (but do allow joke entries to appear if set). + if !subj.chars().all(|c| c == '?' || c == ' ') { + self.client + .send_notice(target, format!("\x02{}\x0f: never heard of it", subj))?; + } } } Ok(()) -- cgit 1.4.1