View previous topic :: View next topic |
Author |
Message |
Rash Voice
Joined: 20 Jan 2022 Posts: 6
|
Posted: Wed May 18, 2022 9:27 pm Post subject: Link/URL Logger Script Request |
|
|
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 |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1145 Location: France
|
Posted: Fri May 20, 2022 5:05 am Post subject: |
|
|
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 |
|
 |
Rash Voice
Joined: 20 Jan 2022 Posts: 6
|
Posted: Thu Jun 02, 2022 2:17 pm Post subject: |
|
|
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 |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1145 Location: France
|
Posted: Thu Jun 02, 2022 6:23 pm Post subject: |
|
|
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 |
|
 |
Rash Voice
Joined: 20 Jan 2022 Posts: 6
|
Posted: Thu Jun 02, 2022 8:41 pm Post subject: |
|
|
Oh, I am used to the real world! Forgot people are real here. |
|
Back to top |
|
 |
Rash Voice
Joined: 20 Jan 2022 Posts: 6
|
Posted: Thu Jun 02, 2022 8:48 pm Post subject: |
|
|
Alright, SQL Lite and libsqlite3-dev libsqlite3-tcl are installed. |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1145 Location: France
|
Posted: Fri Jun 03, 2022 3:58 am Post subject: |
|
|
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 |
|
 |
Rash Voice
Joined: 20 Jan 2022 Posts: 6
|
Posted: Fri Jun 03, 2022 11:24 am Post subject: |
|
|
Thank you so very much! This is exactly what I was looking for |
|
Back to top |
|
 |
|