<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/20923" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2021-03-03T06:00:18-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/20923</id>

		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-03-03T06:00:18-04:00</updated>

		<published>2021-03-03T06:00:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109462#p109462</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109462#p109462"/>
		<title type="html"><![CDATA[Help for tcl modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109462#p109462"><![CDATA[
The sqlite version:<div class="codebox"><p>Code: </p><pre><code># sqlink loggernamespace eval sqlink {# path to the database (the directory must exists)variable dbpath "databases/"# list of ignored usersvariable ignore {john roger guru}# Command to search for linkvariable call "!link"# Command for statsvariable stats "!linkstats"# output line startvariable out "\002\[\002Link\002\]\002 "variable debug 1if { [catch { package require sqlite3 }] } { putloglev o * "Error : you need sqlite3 package" ; return }variable dbproc opendb {} {sqlite3 ::sqlink::db ${::sqlink::dbpath}/linklogger.sqlite}proc closedb {} {::sqlink::db close}proc init {} {::sqlink::opendb::sqlink::db eval {CREATE TABLE IF NOT EXISTS links (id integer primary key, chan text, nick text, url text, seentime datetime)}::sqlink::db eval {CREATE INDEX IF NOT EXISTS id ON links(id)}::sqlink::db eval {CREATE INDEX IF NOT EXISTS chan ON links(chan)}::sqlink::db eval {CREATE INDEX IF NOT EXISTS nick ON links(nick)}::sqlink::closedb}variable debugstring "Link Logger Debug: "bind pub - $::sqlink::call ::sqlink::linkcallbind pub - $::sqlink::stats ::sqlink::linkstatsbind pubm - "*://*" ::sqlink::linkloggersetudef flag linklogproc linklogger {nick host hand chan arg} {if {$::sqlink::debug == 1} {putlog "$::sqlink::debugstring nick = $nick"putlog "$::sqlink::debugstring host = $host"putlog "$::sqlink::debugstring hand = $hand"putlog "$::sqlink::debugstring chan = $chan"putlog "$::sqlink::debugstring arg = $arg"}if {[channel get $chan linklog]==0} {puthelp "PRIVMSG $chan :not activated here"return 0}if {[lsearch -nocase $::::sqlink::ignore $nick] != -1} {if {$::sqlink::debug == 1} {puts "$::sqlink::debugstring $nick is being ignored"return}return}if {[regexp -- {(https?://[a-z0-9\-]+\.[a-z0-9\-\.]+(?:/|(?:/[a-zA-Z0-9!#\$%&amp;'\*\+,\-\.:;=\?@\[\]_~]+)*))} $arg match url]} {if {$::sqlink::debug == 1} {putlog "$::sqlink::debugstring Found link, chan set and not ignoring user!"putlog "Link is $url"}::sqlink::opendb::sqlink::db eval {INSERT INTO links (chan, nick, url, seentime) VALUES (LOWER($chan), LOWER($nick), $url, strftime('%s','now'))}::sqlink::closedb}}proc linkcall {nick host hand chan arg} {if {[channel get $chan linklog]==0} {puthelp "PRIVMSG $chan :not activated here"return 0}if {[string length $arg] &lt; 1} {puthelp "PRIVMSG $chan :usage: $::sqlink::call &lt;username&gt;"puthelp "PRIVMSG $chan :usage: $::sqlink::stats &lt;username&gt;"puthelp "PRIVMSG $chan :usage: $::sqlink::stats for global stats"   return}if {$::sqlink::debug == 1} {putlog "$::sqlink::debugstring $::sqlink::call triggered linkcall"putlog "$::sqlink::debugstring The argument was $arg"}::sqlink::opendbset ulinks [::sqlink::db eval {SELECT * FROM links WHERE LOWER(nick)=LOWER($arg) AND chan=LOWER($chan) ORDER BY seentime desc}]if {[llength $ulinks]==0} {puthelp "PRIVMSG $chan $::sqlink::out No links found for $arg :("return 0}puthelp "PRIVMSG $chan $::sqlink::out $arg's most recent links"for {set i 0} {$i &lt; [llength $ulinks]} {incr i 5} {puthelp "PRIVMSG $chan :Linked [lindex $ulinks $i+3] on [clock format [lindex $ulinks $i+4] -format %d/%m/%Y\ \@\ %H:%M:%S]"}::sqlink::closedb}proc linkstats {nick host hand chan text} {if {[channel get $chan linklog]==0} {puthelp "PRIVMSG $chan :not activated here"return 0}if {[llength [split $text]] == 1} {set where " AND LOWER(nick)=LOWER($nick)"} else {set where ""}::sqlink::opendbset top [::sqlink::db eval {SELECT COUNT(*) AS top, nick FROM links WHERE chan=LOWER($chan)$where GROUP BY nick ORDER BY top DESC LIMIT 3}]if {[llength $top]==0} {putserv "PRIVMSG $chan :No links where posted here"return 0}putserv "PRIVMSG $chan :Top spammers for $chan"for {set i 0} {$i &lt; [llength $top]} {incr i 2} {putserv "PRIVMSG $chan :[lindex $top $i+1] with [lindex $top $i] links"}::sqlink::closedb}}::sqlink::init</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Wed Mar 03, 2021 6:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-03-03T04:14:31-04:00</updated>

		<published>2021-03-03T04:14:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109459#p109459</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109459#p109459"/>
		<title type="html"><![CDATA[Help for tcl modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109459#p109459"><![CDATA[
So... I just made 2 errors in my previous script.<br>Here is the working one:<div class="codebox"><p>Code: </p><pre><code>######################################################    link logger v 1.1 by m00nie#            www.m00nie.com##   Mostly written as a way to practice TCL....# V1.1 Added Global Stats# V1.0 Original release###################################################### Settings to edit below###################################################### Debug? Enabling debug is very verbose!set linklog(debug) 1# Users to ignore? E.g other botsset linklog(ignore) "some people"# Command to search for linkset linklog(call) "!link"# Command for statsset linklog(stats) "!linkstats"# Location of the file to store linksset linklog(location) "databases/links_"# output line startset linklog(out) "\002\[\002Link\002\]\002 "###################################################### No need to edit anything from below here#####################################################set linklog(debugstring) "Link Logger Debug: "bind pub - $linklog(call) linkcallbind pub - $linklog(stats) linkstatsbind pubm - "*://*" linkloggersetudef flag linklog#################### Link logging process###################proc linklogger {nick host hand chan arg} {   global linklog   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) nick = $nick"      putlog "$linklog(debugstring) host = $host"      putlog "$linklog(debugstring) hand = $hand"      putlog "$linklog(debugstring) chan = $chan"      putlog "$linklog(debugstring) arg = $arg"   }   ###################   # Checking the channel has been set   ###################   if {[channel get $chan linklog]==0} {      puthelp "PRIVMSG $chan :not activated here"      return 0   } else {      set tchan [string tolower $chan]   }   ###################   # Check is user ignored   ###################   set linklog(ignoretest) [regexp -nocase $nick $linklog(ignore)]   if {$linklog(ignoretest) == 1} {      if {$linklog(debug) == 1} {         puts "$linklog(debugstring) $nick is being ignored"         puts "$linklog(debugstring) Ingnore variable is $linklog(ignore)"         return      }      return   }   ###################   # Check for a link   ###################   if {[regexp -- {(https?://[a-z0-9\-]+\.[a-z0-9\-\.]+(?:/|(?:/[a-zA-Z0-9!#\$%&amp;'\*\+,\-\.:;=\?@\[\]_~]+)*))} $arg match linklog(url)]} {      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) Found link, chan set and not ignoring user!"         putlog "Link is $linklog(url)"      }      ###################      # Open the file append and close      ###################      set time [clock seconds]      set linklog(fileappend) [open $linklog(location)${tchan}_$nick a]      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) File $linklog(location) opened at $time"      }      puts $linklog(fileappend) "Linked to $linklog(url) @ [clock format $time]"      close $linklog(fileappend)      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) File $linklog(location) closed"      }   } else {      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) This shouldnt really happen....."         putlog "$linklog(debugstring) Channel set, user not ignored but no valid link!"      }   }}#################### Link searching###################proc linkcall {nick host hand chan arg} {   global linklog   if {[channel get $chan linklog]==0} {      puthelp "PRIVMSG $chan :not activated here"      return 0   } else {      set tchan [string tolower $chan]   }   ###################   # Check for no arguments then spam help   ###################   if {[string length $arg] &lt; 1} {      puthelp "PRIVMSG $chan :usage: $linklog(call) &lt;username&gt;"      puthelp "PRIVMSG $chan :usage: $linklog(stats) &lt;username&gt;"      puthelp "PRIVMSG $chan :usage: $linklog(stats) for global stats"         return   }   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) $linklog(call) triggered linkcall"      putlog "$linklog(debugstring) The argument was $arg"   }   ###################   # Check a file exists   ###################   set linklog(fileresult) [linkfilecheck $linklog(location)${tchan}_$arg]   if {$linklog(fileresult) != 1} {      puthelp "PRIVMSG $chan $linklog(out) No links found for $arg :("      putlog "$linklog(debugstring) File $linklog(location)$arg doesnt exist??"      return   }   ###################   # Open and read the file line by line   ###################   set loop 0   set linklog(fileopen) [open $linklog(location)${tchan}_$arg r]   set lines [split [read -nonewline $linklog(fileopen)] "\n"]   puthelp "PRIVMSG $chan $linklog(out) $arg's most recent links"   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) $linklog(location)$arg File open and split"   }   for {set i [llength $lines]} {$i} {incr i -1} {      set line [lindex $lines $i-1]      if {$loop &gt; 2} {         return      }      puthelp "PRIVMSG $chan $line"      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) loop = $loop "      }      incr loop   }   close $linklog(fileopen)   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) File $linklog(location)$arg closed"   }}#################### Get some stats###################proc linkstats {nick host hand chan arg} {   global linklog   if {[channel get $chan linklog]==0} {      puthelp "PRIVMSG $chan :not activated here"      return 0   } else {      set tchan [string tolower $chan]   }   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) link stats called with arg $arg"   }   if {[string length $arg] &lt; 1} {      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) No arg given to $linklog(stats)"      }      set files [glob $linklog(location)${tchan}_*]      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) Files to be checked are $files"      }      if { [llength $files] &gt; 0 } {         foreach f [lsort $files] {            set name [lindex [split $f "_"] end]            set size [linklinecount $f]            lappend thelist "$name $size"         }      } else {         puthelp "PRIVMSG $chan $linklog(out) Nobody has linked to anything :o"      }      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) unsorted list is $thelist "      }      lappend outputlist [lsort -index 1 -decreasing -integer $thelist]      if {$linklog(debug) == 1} {         putlog "$linklog(debugstring) Sorted list is $outputlist"      }      set x "0"      while {$x &lt; 3} {         set list [lindex $outputlist 0 $x]         incr x         lassign $list user count         if {$count &lt; 0} {            return         }         if {$x == 1} {            puthelp "PRIVMSG $chan $linklog(out) Top link spammers"         }         puthelp "PRIVMSG $chan $x. $user spammed $count links"      }      return   }   # Check the file exists first   set linklog(fileresult) [linkfilecheck $linklog(location)$arg]   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) files we try to open will be $linklog(fileresult)"   }   if {$linklog(fileresult) != 1} {      puthelp "PRIVMSG $chan $linklog(out) No links found for $arg :("      putlog "$linklog(debugstring) File $linklog(location)$arg doesnt exist??"      return   }   # Count the links   set linkcount [linklinecount $linklog(location)$arg]   puthelp "PRIVMSG $chan $arg has spammed $linkcount links"}#################### Count the lines in a file###################proc linklinecount {FILENAME} {   global linklog   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) Linklinecount called with arg $FILENAME"   }   # c   set i 0   set fid [open $FILENAME r]   while {[gets $fid line] &gt; -1} {incr i}   close $fid   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) Linklinecount returning $i lines counted"   }   return $i}#################### Check file exsists###################proc linkfilecheck {FILENAME} {   global linklog   if {$linklog(debug) == 1} {      putlog "$linklog(debugstring) Linkfilecheck called with arg $FILENAME"   }   # checking the file exists   if [file exists $FILENAME] then {      # file exists      return 1   } else {      # file not exists      return "0"   }}putlog "link logger v 1.1 by m00nie http://www.m00nie.com :)" </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Wed Mar 03, 2021 4:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-03-02T18:48:20-04:00</updated>

		<published>2021-03-02T18:48:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109458#p109458</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109458#p109458"/>
		<title type="html"><![CDATA[Help for tcl modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109458#p109458"><![CDATA[
As I said, my changes weren't tested, I'll look further tomorrow.<br><br>But you haven't to create the files by the hand, it's just the old files which cannot be used and that you have to rename if you want to keep the old datas.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Tue Mar 02, 2021 6:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Suratka]]></name></author>
		<updated>2021-03-02T11:55:49-04:00</updated>

		<published>2021-03-02T11:55:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109456#p109456</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109456#p109456"/>
		<title type="html"><![CDATA[Help for tcl modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109456#p109456"><![CDATA[
Hi. i just tested the tc you edited.<br><br>Now I can enable it in the channels where I want via .chanset<br>The rest doesn't work.<br><br>when in the set channel a user types a link it is not registered, the tcl does not create any log file.<br> I tried to create it by hand example:<br>links_ # channel_nick<br>and when that nick spams a link in the channel here is the response of the bot in partyline:<br><div class="codebox"><p>Code: </p><pre><code>[15:41:08] Link Logger Debug:  nick = UNKNOWN[15:41:08] Link Logger Debug:  host = SMCV@8780DF14.233F274D.EC498D0F.IP[15:41:08] Link Logger Debug:  hand = *[15:41:08] Link Logger Debug:  chan = #siamosolonoi[15:41:08] Link Logger Debug:  arg = https://www.iol.it[15:41:08] Link Logger Debug:  #siamosolonoi is not set to log links!</code></pre></div>after which I try to type in channel:! link nick and I get this:<br><br><br><div class="codebox"><p>Code: </p><pre><code>[15:48:19] Link Logger Debug:  !link triggered linkcall[15:48:19] Link Logger Debug:  The argument was UNKNOWN[15:48:19] Link Logger Debug:  Linkfilecheck called with arg /home/server/arale/                                                                                                                     loglink/links_#siamosolonoi_UNKNOWN[15:48:19] Tcl error [linkcall]: couldn't open "/home/server/arale/loglink/links                                                                                                                     _UNKNOWN": no such file or directory</code></pre></div>and even if it worked, it would have been impractical. Because from what I understand, you have to create the files by hand. The original tcl created a file for each user who wrote a links, which could then be called up via the public command! Link nick.<br><br>So it doesn't make sense.<br>I thought once it became multichan, tcl would create a directory for each channel. instead it puts everyone in the same directory, but that's not the point. The fact is that the system does not create the log files.<br>I think I will keep it as it was and at most I will only use the modification you made to enable it via chanset. so there is no danger that it will work in other channels.<br>Thanks: D<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12635">Suratka</a> — Tue Mar 02, 2021 11:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-03-02T04:54:10-04:00</updated>

		<published>2021-03-02T04:54:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109454#p109454</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109454#p109454"/>
		<title type="html"><![CDATA[Help for tcl modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109454#p109454"><![CDATA[
Here is a short untested modification.<br>do a <strong class="text-strong">.chanset #chan +linklog</strong> to enable the script in your chan.<br><br>Beware that omd files must be renamed to add the chan name before the nick.<br>Exemple: links_lamer must become links_siamosolonoi_lamer<br><div class="codebox"><p>Code: </p><pre><code>######################################################    link logger v 1.1 by m00nie#            www.m00nie.com##   Mostly written as a way to practice TCL....# V1.1 Added Global Stats# V1.0 Original release###################################################### Settings to edit below###################################################### Debug? Enabling debug is very verbose!set linklog(debug) 1# Users to ignore? E.g other botsset linklog(ignore) "some people"# Command to search for linkset linklog(call) "!link"# Command for statsset linklog(stats) "!linkstats"# Location of the file to store linksset linklog(location) "/home/server/arale/loglink/links_"# output line startset linklog(out) "\002\[\002Link\002\]\002 "###################################################### No need to edit anything from below here#####################################################set linklog(debugstring) "Link Logger Debug: "bind pub - $linklog(call) linkcallbind pub - $linklog(stats) linkstatsbind pubm - "$linklog(chanset) *://*" linkloggersetudef flag linklog#################### Link logging process###################proc linklogger {nick host hand chan arg} {global linklogif {$linklog(debug) == 1} {putlog "$linklog(debugstring) nick = $nick"putlog "$linklog(debugstring) host = $host"putlog "$linklog(debugstring) hand = $hand"putlog "$linklog(debugstring) chan = $chan"putlog "$linklog(debugstring) arg = $arg"}#################### Checking the channel has been set###################if {[channel get $chan linklog]!=0} {set tchan [string tolower $chan]if {$linklog(debug) == 1} {putlog "$linklog(debugstring) $chan is not set to log links!"return}return}#################### Check is user ignored###################set linklog(ignoretest) [regexp -nocase $nick $linklog(ignore)]if {$linklog(ignoretest) == 1} {if {$linklog(debug) == 1} {puts "$linklog(debugstring) $nick is being ignored"puts "$linklog(debugstring) Ingnore variable is $linklog(ignore)"return}return}#################### Check for a link###################if {[regexp -- {(https?://[a-z0-9\-]+\.[a-z0-9\-\.]+(?:/|(?:/[a-zA-Z0-9!#\$%&amp;'\*\+,\-\.:;=\?@\[\]_~]+)*))} $arg match linklog(url)]} {if {$linklog(debug) == 1} {putlog "$linklog(debugstring) Found link, chan set and not ignoring user!"putlog "Link is $linklog(url)"}#################### Open the file append and close###################set time [clock seconds]set linklog(fileappend) [open $linklog(location)${tchan}_$nick a]if {$linklog(debug) == 1} {putlog "$linklog(debugstring) File $linklog(location) opened at $time"}puts $linklog(fileappend) "Linked to $linklog(url) @ [clock format $time]"close $linklog(fileappend)if {$linklog(debug) == 1} {putlog "$linklog(debugstring) File $linklog(location) closed"}} else {if {$linklog(debug) == 1} {putlog "$linklog(debugstring) This shouldnt really happen....."putlog "$linklog(debugstring) Channel set, user not ignored but no valid link!"}}}#################### Link searching###################proc linkcall {nick host hand chan arg} {global linklogif {[channel get $chan linklog]==0} {puthelp "PRIVMSG $chan :not activated here"return 0} else {set tchan [string tolower $chan]}#################### Check for no arguments then spam help###################if {[string length $arg] &lt; 1} {puthelp "PRIVMSG $chan :usage: $linklog(call) &lt;username&gt;"puthelp "PRIVMSG $chan :usage: $linklog(stats) &lt;username&gt;"puthelp "PRIVMSG $chan :usage: $linklog(stats) for global stats"   return}if {$linklog(debug) == 1} {putlog "$linklog(debugstring) $linklog(call) triggered linkcall"putlog "$linklog(debugstring) The argument was $arg"}#################### Check a file exists###################set linklog(fileresult) [linkfilecheck $linklog(location)${tchan}_$arg]if {$linklog(fileresult) != 1} {puthelp "PRIVMSG $chan $linklog(out) No links found for $arg :("putlog "$linklog(debugstring) File $linklog(location)$arg doesnt exist??"return}#################### Open and read the file line by line###################set loop 0set linklog(fileopen) [open $linklog(location)$arg r]set lines [split [read -nonewline $linklog(fileopen)] "\n"]puthelp "PRIVMSG $chan $linklog(out) $arg's most recent links"if {$linklog(debug) == 1} {putlog "$linklog(debugstring) $linklog(location)$arg File open and split"}for {set i [llength $lines]} {$i} {incr i -1} {set line [lindex $lines $i-1]if {$loop &gt; 2} {return}puthelp "PRIVMSG $chan $line"if {$linklog(debug) == 1} {putlog "$linklog(debugstring) loop = $loop "}incr loop}close $linklog(fileopen)if {$linklog(debug) == 1} {putlog "$linklog(debugstring) File $linklog(location)$arg closed"}}#################### Get some stats###################proc linkstats {nick host hand chan arg} {global linklogif {[channel get $chan linklog]==0} {puthelp "PRIVMSG $chan :not activated here"return 0} else {set tchan [string tolower $chan]}if {$linklog(debug) == 1} {putlog "$linklog(debugstring) link stats called with arg $arg"}if {[string length $arg] &lt; 1} {if {$linklog(debug) == 1} {putlog "$linklog(debugstring) No arg given to $linklog(stats)"}set files [glob $linklog(location)${tchan}_*]if {$linklog(debug) == 1} {putlog "$linklog(debugstring) Files to be checked are $files"}if { [llength $files] &gt; 0 } {foreach f [lsort $files] {set name [lindex [split $f "_"] end]set size [linklinecount $f]lappend thelist "$name $size"}} else {puthelp "PRIVMSG $chan $linklog(out) Nobody has linked to anything :o"}if {$linklog(debug) == 1} {putlog "$linklog(debugstring) unsorted list is $thelist "}lappend outputlist [lsort -index 1 -decreasing -integer $thelist]if {$linklog(debug) == 1} {putlog "$linklog(debugstring) Sorted list is $outputlist"}set x "0"while {$x &lt; 3} {set list [lindex $outputlist 0 $x]incr xlassign $list user countif {$count &lt; 0} {return}if {$x == 1} {puthelp "PRIVMSG $chan $linklog(out) Top link spammers"}puthelp "PRIVMSG $chan $x. $user spammed $count links"}return}# Check the file exists firstset linklog(fileresult) [linkfilecheck $linklog(location)$arg]if {$linklog(debug) == 1} {putlog "$linklog(debugstring) files we try to open will be $linklog(fileresult)"}if {$linklog(fileresult) != 1} {puthelp "PRIVMSG $chan $linklog(out) No links found for $arg :("putlog "$linklog(debugstring) File $linklog(location)$arg doesnt exist??"return}# Count the linksset linkcount [linklinecount $linklog(location)$arg]puthelp "PRIVMSG $chan $arg has spammed $linkcount links"}#################### Count the lines in a file###################proc linklinecount {FILENAME} {global linklogif {$linklog(debug) == 1} {putlog "$linklog(debugstring) Linklinecount called with arg $FILENAME"}# cset i 0set fid [open $FILENAME r]while {[gets $fid line] &gt; -1} {incr i}close $fidif {$linklog(debug) == 1} {putlog "$linklog(debugstring) Linklinecount returning $i lines counted"}return $i}#################### Check file exsists###################proc linkfilecheck {FILENAME} {global linklogif {$linklog(debug) == 1} {putlog "$linklog(debugstring) Linkfilecheck called with arg $FILENAME"}# checking the file existsif [file exists $FILENAME] then {# file existsreturn 1} else {# file not existsreturn "0"}}putlog "link logger v 1.1 by m00nie http://www.m00nie.com :)" </code></pre></div>I'll do a sqlite version, you'll see how it' simplest and it only requires one package.<br>If you don't want to use this evolution, some could be interested in it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Tue Mar 02, 2021 4:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Suratka]]></name></author>
		<updated>2021-03-01T20:14:07-04:00</updated>

		<published>2021-03-01T20:14:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109450#p109450</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109450#p109450"/>
		<title type="html"><![CDATA[sq lite ???]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109450#p109450"><![CDATA[
sorry what do you mean by sqlite db?<br>I don't know how to get started with the sqlite db.<br><br>I only use tcl which creates simple db files inside the eggdrop.<br>Creating a tcl that needs sqlite would mean to me working on sqlite and I don't even know what it is.<br><br> I only know how to install an eggdrop and simple tcls, in fact many complex tcls that require other dependencies I avoid them like the plague. : D<br><br>I just want this script to be settable and that it can choose which channels to run in, and that each channel has its own folder where it puts the txt nicknames that have written links to that channel.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12635">Suratka</a> — Mon Mar 01, 2021 8:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-03-01T19:11:32-04:00</updated>

		<published>2021-03-01T19:11:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109449#p109449</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109449#p109449"/>
		<title type="html"><![CDATA[Help for tcl modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109449#p109449"><![CDATA[
Wow, such a complex script for a simple feature.<br><br>I can correct it to work as you want, and I can modify it to use a sqlite DB. This second alternative will do a simplest script, and probably more secured <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Mon Mar 01, 2021 7:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Suratka]]></name></author>
		<updated>2021-03-01T15:05:01-04:00</updated>

		<published>2021-03-01T15:05:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109448#p109448</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109448#p109448"/>
		<title type="html"><![CDATA[Help for tcl modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109448#p109448"><![CDATA[
Hello friends. I need a favor. I have installed a tcl that records the links that are posted in the channel. create the various files_nick_user.log in a logs folder and when in public we type :! link nick<br>Eggdrop returns the last three links NICK posted on the channel.<br>This tcl only works on one channel at a time. in fact the channel must be set in the tcl. I wish it could work on multiple channels.<br>Now the tcl is set to one channel only, and records user links in that channel only, but the command! Link nick returns the response in other non-enabled channels as well. I would like to avoid this.<br>Indeed if possible, I would like you to create db files belonging to each channel I enable. so I would like to modify the tcl in such a way that it is multichan settable and that it keeps the db for each channel.<br>it's possible?<br><br><div class="codebox"><p>Code: </p><pre><code>###################################################### link logger v 1.1 by m00nie#      www.m00nie.com##   Mostly written as a way to practice TCL....# V1.1 Added Global Stats# V1.0 Original release###################################################### Settings to edit below###################################################### chan to useset linklog(chanset) "#siamosolonoi"# Debug? Enabling debug is very verbose!set linklog(debug) 1# Users to ignore? E.g other botsset linklog(ignore) "some people"# Command to search for linkset linklog(call) "!link"# Command for statsset linklog(stats) "!linkstats"# Location of the file to store linksset linklog(location) "/home/server/arale/loglink/links_"# output line startset linklog(out) "\002\[\002Link\002\]\002 "###################################################### No need to edit anything from below here#####################################################set linklog(debugstring) "Link Logger Debug: "bind pub - $linklog(call) linkcall bind pub - $linklog(stats) linkstatsbind pubm - "$linklog(chanset) *://*" linklogger#################### Link logging process###################proc linklogger {nick host hand chan arg} {global linklogif {$linklog(debug) == 1} {putlog "$linklog(debugstring) nick = $nick"putlog "$linklog(debugstring) host = $host"putlog "$linklog(debugstring) hand = $hand"putlog "$linklog(debugstring) chan = $chan"putlog "$linklog(debugstring) arg = $arg"}#################### Checking the channel has been set###################        if {$chan != $linklog(chanset)} {if {$linklog(debug) == 1} {putlog "$linklog(debugstring) $chan is not set to log links!"putlog "$linklog(debugstring) chan is set to $linklog(chanset)"return}return}#################### Check is user ignored###################set linklog(ignoretest) [regexp -nocase $nick $linklog(ignore)]if {$linklog(ignoretest) == 1} { if {$linklog(debug) == 1} {puts "$linklog(debugstring) $nick is being ignored"puts "$linklog(debugstring) Ingnore variable is $linklog(ignore)"return }return}#################### Check for a link###################if {[regexp -- {(https?://[a-z0-9\-]+\.[a-z0-9\-\.]+(?:/|(?:/[a-zA-Z0-9!#\$%&amp;'\*\+,\-\.:;=\?@\[\]_~]+)*))} $arg match linklog(url)]} {if {$linklog(debug) == 1} {putlog "$linklog(debugstring) Found link, chan set and not ignoring user!"putlog "Link is $linklog(url)"}#################### Open the file append and close###################set time [clock seconds]set linklog(fileappend) [open $linklog(location)$nick a]if {$linklog(debug) == 1} {putlog "$linklog(debugstring) File $linklog(location) opened at $time"}puts $linklog(fileappend) "Linked to $linklog(url) @ [clock format $time]"close $linklog(fileappend) if {$linklog(debug) == 1} {putlog "$linklog(debugstring) File $linklog(location) closed"}} else {if {$linklog(debug) == 1} {putlog "$linklog(debugstring) This shouldnt really happen....."putlog "$linklog(debugstring) Channel set, user not ignored but no valid link!"}}}#################### Link searching###################proc linkcall {nick host hand chan arg} {global linklog#################### Check for no arguments then spam help###################if {[string length $arg] &lt; 1} {                puthelp "PRIVMSG $chan :usage: $linklog(call) &lt;username&gt;"puthelp "PRIVMSG $chan :usage: $linklog(stats) &lt;username&gt;"puthelp "PRIVMSG $chan :usage: $linklog(stats) for global stats"return}if {$linklog(debug) == 1} {putlog "$linklog(debugstring) $linklog(call) triggered linkcall"putlog "$linklog(debugstring) The argument was $arg"}#################### Check a file exists###################set linklog(fileresult) [linkfilecheck $linklog(location)$arg]if {$linklog(fileresult) != 1} {puthelp "PRIVMSG $chan $linklog(out) No links found for $arg :("putlog "$linklog(debugstring) File $linklog(location)$arg doesnt exist??"return}#################### Open and read the file line by line###################set loop 0set linklog(fileopen) [open $linklog(location)$arg r]set lines [split [read -nonewline $linklog(fileopen)] "\n"]puthelp "PRIVMSG $chan $linklog(out) $arg's most recent links"if {$linklog(debug) == 1} {putlog "$linklog(debugstring) $linklog(location)$arg File open and split"}for {set i [llength $lines]} {$i} {incr i -1} {set line [lindex $lines $i-1]if {$loop &gt; 2} {return}puthelp "PRIVMSG $chan $line"        if {$linklog(debug) == 1} {                        putlog "$linklog(debugstring) loop = $loop "                } incr loop}close $linklog(fileopen)if {$linklog(debug) == 1} {putlog "$linklog(debugstring) File $linklog(location)$arg closed"}}#################### Get some stats###################proc linkstats {nick host hand chan arg} {global linklogif {$linklog(debug) == 1} {putlog "$linklog(debugstring) link stats called with arg $arg"}if {[string length $arg] &lt; 1} {if {$linklog(debug) == 1} {putlog "$linklog(debugstring) No arg given to $linklog(stats)"}set files [glob $linklog(location)*]if {$linklog(debug) == 1} {putlog "$linklog(debugstring) Files to be checked are $files"}if { [llength $files] &gt; 0 } {foreach f [lsort $files] {set name [regsub -nocase {.*links\_} $f {}]set size [linklinecount $f]lappend thelist "$name $size" } } else {puthelp "PRIVMSG $chan $linklog(out) Nobody has linked to anything :o" }         if {$linklog(debug) == 1} {                        putlog "$linklog(debugstring) unsorted list is $thelist "                 } lappend outputlist [lsort -index 1 -decreasing -integer $thelist] if {$linklog(debug) == 1} {                         putlog "$linklog(debugstring) Sorted list is $outputlist"                 }                 set x "0" while {$x &lt; 3} {set list [lindex $outputlist 0 $x]incr xlassign $list user countif {$count &lt; 0} {return}if {$x == 1} {puthelp "PRIVMSG $chan $linklog(out) Top link spammers"}puthelp "PRIVMSG $chan $x. $user spammed $count links"}return}# Check the file exists firstset linklog(fileresult) [linkfilecheck $linklog(location)$arg]if {$linklog(debug) == 1} {putlog "$linklog(debugstring) files we try to open will be $linklog(fileresult)"}if {$linklog(fileresult) != 1} {puthelp "PRIVMSG $chan $linklog(out) No links found for $arg :("putlog "$linklog(debugstring) File $linklog(location)$arg doesnt exist??"return}# Count the linksset linkcount [linklinecount $linklog(location)$arg]        puthelp "PRIVMSG $chan $arg has spammed $linkcount links"}#################### Count the lines in a file###################proc linklinecount {FILENAME} {global linklogif {$linklog(debug) == 1} {putlog "$linklog(debugstring) Linklinecount called with arg $FILENAME"}# c        set i 0        set fid [open $FILENAME r]        while {[gets $fid line] &gt; -1} {incr i}        close $fidif {$linklog(debug) == 1} {                putlog "$linklog(debugstring) Linklinecount returning $i lines counted"        }        return $i}#################### Check file exsists###################proc linkfilecheck {FILENAME} {global linklogif {$linklog(debug) == 1} {putlog "$linklog(debugstring) Linkfilecheck called with arg $FILENAME"}# checking the file exists        if [file exists $FILENAME] then {        # file existsreturn 1        } else {        # file not existsreturn "0"}}putlog "link logger v 1.1 by m00nie http://www.m00nie.com :)"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12635">Suratka</a> — Mon Mar 01, 2021 3:05 pm</p><hr />
]]></content>
	</entry>
	</feed>
