about summary refs log tree commit diff
path: root/fun/paroxysm/src/main.rs
diff options
context:
space:
mode:
authoreta <eta@theta.eu.org>2021-05-26T23·38+0100
committereta <eta@theta.eu.org>2021-08-13T11·00+0000
commit4286574b3bce4d55cd8149da516b0899fcbd8032 (patch)
treed54fbce3f840671b7f1100bfdc950e1ba1a71097 /fun/paroxysm/src/main.rs
parent7c16a7115654a2061ddfe61055eef181474eeab3 (diff)
feat(paroxysm): don't print error messages for question marks r/2727
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 <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: cynthia <cynthia@tvl.fyi>
Diffstat (limited to 'fun/paroxysm/src/main.rs')
-rw-r--r--fun/paroxysm/src/main.rs8
1 files changed, 6 insertions, 2 deletions
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(())