From f453a88bcab5e6cac39a021958aa6f819a78dd1b Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Fri, 22 Nov 2024 11:06:18 -0500 Subject: [PATCH] regex tweaks --- config.ini | 2 +- jetstream.tcl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.ini b/config.ini index 201fd05..125695a 100644 --- a/config.ini +++ b/config.ini @@ -1,5 +1,5 @@ [database] -path = tclposting.db +path = posts.db max_posts = 10000 [atproto] diff --git a/jetstream.tcl b/jetstream.tcl index 49b113f..5582963 100644 --- a/jetstream.tcl +++ b/jetstream.tcl @@ -10,12 +10,12 @@ namespace eval ::jetstream { list ::ws::c::connect $host 443 \ /subscribe?wantedCollections=app.bsky.feed.post on_ws_$postfix] - proc ::jetstream::on_ws_$postfix {sock mode data} [concat [list set db $db] \; { + proc ::jetstream::on_ws_$postfix {sock mode data} [concat [list set db $db] \; [list set postfix $postfix] \; { variable log switch -- $mode { close { # cursed - [dict get [info frame [info frame]] cmd proc]_close + ::jetstream::on_ws_${postfix}_close } text { @@ -27,7 +27,7 @@ namespace eval ::jetstream { switch -- [dict get $data commit operation] { create { set text [dict get $data commit record text] - if [regexp -nocase -- {\stcl(/tk)?(,|\s)|^tcl(/tk)?(,|\s)|\stcl(/tk)?$|\stk(,|\s)|^tk(,|\s)|\stk$|\.tcl|tclsh} $text] { + if {[regexp -- {\s[Tt]cl(/[Tt]k)?(\.|,|\s)|^[Tt]cl(/[Tt]k)?(,|\s)|\s[Tt]cl(/[Tt]k)?$|\sTk(\.|,|\s)|^Tk(,|\s)|\sTk$|\.tcl|tclsh|tcl-lang|tcltk|tcllib|tklib|tcl\.tk|#tcllang} $text]} { set ts [dict get $data commit record createdAt] if ![catch {$db eval {INSERT OR FAIL INTO posts (uri, ts) VALUES ($uri, $ts);}}] { ${log}::info "new tclpost! https://bsky.app/profile/[dict get $data did]/post/[dict get $data commit rkey]" -- 2.45.2