egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Link/URL Logger Script Request

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Rash
Voice


Joined: 20 Jan 2022
Posts: 6

PostPosted: Wed May 18, 2022 9:27 pm    Post subject: Link/URL Logger Script Request Reply with quote

I am looking for a script that logs urls posted to a channel if someone were to link that again, they get insulted for posting an old link.
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1145
Location: France

PostPosted: Fri May 20, 2022 5:05 am    Post subject: Reply with quote

It can be easily done with a little database (sqlite).
Have you sqlite3 and the corresponding tcl package ?

If not, it's possible to use a file but it will decrease performances
_________________
Eggdrop community - French IRC network
Back to top
View user's profile Send private message Visit poster's website
Rash
Voice


Joined: 20 Jan 2022
Posts: 6

PostPosted: Thu Jun 02, 2022 2:17 pm    Post subject: Reply with quote

I could get them installed without issue. Where do we go from here? PayPal? CashApp? Venmo?

Last edited by Rash on Thu Jun 02, 2022 8:48 pm; edited 1 time in total
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1145
Location: France

PostPosted: Thu Jun 02, 2022 6:23 pm    Post subject: Reply with quote

WTF ? Where did I speak about money ? Where in this forum did you read about paid helping ?
_________________
Eggdrop community - French IRC network
Back to top
View user's profile Send private message Visit poster's website
Rash
Voice


Joined: 20 Jan 2022
Posts: 6

PostPosted: Thu Jun 02, 2022 8:41 pm    Post subject: Reply with quote

Oh, I am used to the real world! Forgot people are real here.
Back to top
View user's profile Send private message
Rash
Voice


Joined: 20 Jan 2022
Posts: 6

PostPosted: Thu Jun 02, 2022 8:48 pm    Post subject: Reply with quote

Alright, SQL Lite and libsqlite3-dev libsqlite3-tcl are installed.
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1145
Location: France

PostPosted: Fri Jun 03, 2022 3:58 am    Post subject: Reply with quote

Here is a little script:

Code:
namespace eval logurl {
   
   variable db "urldb.db3"
   
   setudef flag logurl
   
   package require sqlite3
   
   proc db.open {} {
      sqlite3 ::logurl::cnx $::logurl::db
   }

   proc db.close {} {
      ::logurl::cnx close
   }
   
   proc init {} {
      ::logurl::db.open
      ::logurl::cnx eval {CREATE TABLE IF NOT EXISTS logurl (url TEXT, nick TEXT, firstview DATETIME, cpt INTEGER)}
      ::logurl::cnx eval {CREATE INDEX IF NOT EXISTS iurl ON logurl(url)}
      ::logurl::db.close
   }
   
   bind pubm - * ::logurl::logger
   proc logger {nick uhost handle chan text} {
      if {[isbotnick $nick] } { return }
      if {![channel get $chan logurl]} { return }
      if {[regexp -- {(https?:\/\/[^[:space:]]+)} $text match url]} {
         ::logurl::db.open
         set already [::logurl::cnx eval {SELECT nick, firstview, cpt FROM logurl WHERE url=$url}]
         putlog $already
         if {[llength $already]>0} {
            set unick [lindex $already 0]
            set dt [lindex $already 1]
            set cpt [lindex $already 2]
            incr cpt
            putserv "PRIVMSG $chan :\002$url\002 has already been announced by $unick on [clock format $dt -format "%m-%d-%Y"] and was given $cpt times"
            ::logurl::cnx eval {UPDATE logurl SET cpt=$cpt WHERE url=$url}
         } else {
            ::logurl::cnx eval {INSERT INTO logurl (url, nick, firstview, cpt) VALUES ($url, $nick, strftime('%s','now'), 1)}
         }
         ::logurl::db.close
      }
   }
   
   ::logurl::init

}


Think to do .chanset #channel +logurl to activate the script on the channels.
_________________
Eggdrop community - French IRC network
Back to top
View user's profile Send private message Visit poster's website
Rash
Voice


Joined: 20 Jan 2022
Posts: 6

PostPosted: Fri Jun 03, 2022 11:24 am    Post subject: Reply with quote

Thank you so very much! This is exactly what I was looking for
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber