This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Link/URL Logger Script Request

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
R
Rash
Voice
Posts: 6
Joined: Thu Jan 20, 2022 9:10 pm

Link/URL Logger Script Request

Post by Rash »

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.
User avatar
CrazyCat
Revered One
Posts: 1215
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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
R
Rash
Voice
Posts: 6
Joined: Thu Jan 20, 2022 9:10 pm

Post by Rash »

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.
User avatar
CrazyCat
Revered One
Posts: 1215
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

WTF ? Where did I speak about money ? Where in this forum did you read about paid helping ?
R
Rash
Voice
Posts: 6
Joined: Thu Jan 20, 2022 9:10 pm

Post by Rash »

Oh, I am used to the real world! Forgot people are real here.
R
Rash
Voice
Posts: 6
Joined: Thu Jan 20, 2022 9:10 pm

Post by Rash »

Alright, SQL Lite and libsqlite3-dev libsqlite3-tcl are installed.
User avatar
CrazyCat
Revered One
Posts: 1215
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Here is a little script:

Code: Select all

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.
R
Rash
Voice
Posts: 6
Joined: Thu Jan 20, 2022 9:10 pm

Post by Rash »

Thank you so very much! This is exactly what I was looking for
Post Reply