diff options
author | eta <eta@theta.eu.org> | 2020-07-14T17·47+0100 |
---|---|---|
committer | eta <eta@theta.eu.org> | 2020-07-14T17·59+0000 |
commit | d3ad338726b78915ee79e4a7d007daf3129e70f1 (patch) | |
tree | 6c12b601dd83fbae71da15e78924790de30fe5e1 /fun/tvldb/src/main.rs | |
parent | 209f8ef79f7844b7e883cf145515a16e44487ed6 (diff) |
fix(tvldb): unbreak quote grabbing r/1292
Change-Id: Ib03561bbcc154aeee50a592332a2763ff784bb1d Reviewed-on: https://cl.tvl.fyi/c/depot/+/1165 Tested-by: BuildkiteCI Reviewed-by: eta <eta@theta.eu.org> Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'fun/tvldb/src/main.rs')
-rw-r--r-- | fun/tvldb/src/main.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fun/tvldb/src/main.rs b/fun/tvldb/src/main.rs index f95b27656d1a..510cf0461b89 100644 --- a/fun/tvldb/src/main.rs +++ b/fun/tvldb/src/main.rs @@ -141,20 +141,21 @@ impl App { qlast: Captures, ) -> Result<(), Error> { let db = self.pg.get()?; + let nick_to_grab = &qlast["subj"].to_ascii_lowercase(); let mut kwd = self.keyword_from_captures(&qlast, nick, chan)?; let chan_lastmsgs = self .last_msgs .entry(chan.to_string()) .or_insert(HashMap::new()); // Use `nick` here, so things like "grfn: see glittershark" work. - let val = if let Some(last) = chan_lastmsgs.get(&nick.to_ascii_lowercase()) { + let val = if let Some(last) = chan_lastmsgs.get(nick_to_grab) { if last.starts_with("\x01ACTION ") { // Yes, this is inefficient, but it's better than writing some hacky CTCP parsing code // I guess (also, characters are hard, so just blindly slicing seems like a bad idea) - format!("* {} {}", nick, last.replace("\x01ACTION ", "").replace("\x01", "")) + format!("* {} {}", nick_to_grab, last.replace("\x01ACTION ", "").replace("\x01", "")) } else { - format!("<{}> {}", nick, last) + format!("<{}> {}", nick_to_grab, last) } } else { Err(format_err!("I dunno what {} said...", kwd.keyword.name))? |