~aleteoryx/tclfeed-bsky

f453a88bcab5e6cac39a021958aa6f819a78dd1b — Aleteoryx 30 days ago 51c2b9d
regex tweaks
2 files changed, 4 insertions(+), 4 deletions(-)

M config.ini
M jetstream.tcl
M config.ini => config.ini +1 -1
@@ 1,5 1,5 @@
[database]
path = tclposting.db
path = posts.db
max_posts = 10000

[atproto]

M jetstream.tcl => jetstream.tcl +3 -3
@@ 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]"