@@ 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]"