<?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/18241" />

	<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>2011-01-13T10:43:58-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Elements]]></name></author>
		<updated>2011-01-13T10:43:58-04:00</updated>

		<published>2011-01-13T10:43:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95648#p95648</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95648#p95648"/>
		<title type="html"><![CDATA[!addquote word count limit]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95648#p95648"><![CDATA[
there seems to be a limit in how many words per quote the script can take as input,<br>but i also noticed that in other quote scripts so i guess is a general limit, <br>can this be fixed ?<br><div class="codebox"><p>Code: </p><pre><code>################################################################################################## CodeNinja Quote System v1.0.1                                                                 ##                                                                                               ## Commands (&lt;required&gt; [optional]):                                                             ##  !addquote &lt;quote&gt; (adds a quote)                                                             ##  !delquote &lt;quote id&gt; (deletes a quote)                                                       ##  !quote [quote id] (gets a specific or random quote)                                          ##  !findquote &lt;regexp string&gt; (find quotes matching regexp string)                              ##  !lastquote (get the last quote added to the database)                                        ##  !quoteauth &lt;nick&gt; (find quotes added by nick)                                                ##  !quotechan &lt;#chan&gt; (find quotes added in #chan)                                              ##                                                                                               ## Changes                                                                                       ##  v1.0.1                                                                                       ##  -Quote file is automatically added upon adding first quote                                   ##  -Fixed a bug with random quotes                                                              ##  v1.0.2                                                                                       ##  -Changed how search commands (e.g. !findquote, !quoteauth, and !quotechan) handle            ##   excess results                                                                              ##  -Fixed a var mix-up                                                                          ##                                                                                               ## For updates, check out https://sites.google.com/site/codeninjacodes/                          ##                                                                                               ## To report bugs, email me at codeninja68@gmail.com                                             ##                                                                                               ##################################################################################################namespace eval codeninja {    namespace eval quotesys {        # File to store quotes in        variable qfile "data/quote.txt"        # Limit of lines before quote is sent to private instead of the channel        variable plines 6        # Use notice for private instead of message?        variable notice 1        # Maximum number of search results to display (0 for no limit)        # WARNING: if you do not enable this there is a chance the bot will get booted from the        # server if there are too many results        variable flimit 15        # Line divider to use when adding quotes        variable div "|"        # Command character        variable cmdchar "!"        # Flags required to delete quotes        variable dflags "m"    }}# END CONFIG - DO NOT EDIT BELOW THISnamespace eval codeninja {    namespace eval quotesys {        variable ver "v1.0.1"        proc add {nick uhost hand chan text} {            if {[string trim $text] == ""} { putserv "PRIVMSG $chan :No quote specified"                return            }            set filesock [open ${codeninja::quotesys::qfile} {WRONLY APPEND CREAT}]            puts $filesock "\{$text\} $nick $chan [unixtime]"            close $filesock            putserv "PRIVMSG $chan :Quote added to storage file"        }        proc del {nick uhost hand chan text} {            if {![regexp {^([0-9]+)$} $text]} { putserv "PRIVMSG $chan :Invalid quote ID"                return            }            set filesock [open ${codeninja::quotesys::qfile} r]            set quotelist [split [string trimright [read $filesock] "\n"] "\n"]            close $filesock            if {[lindex $quotelist [expr $text - 1]] == ""} { putserv "PRIVMSG $chan :Invalid quote ID"                return            }            set filesock [open ${codeninja::quotesys::qfile} w]            set x 0            foreach quote $quotelist {                if {$x != [expr $text - 1]} { puts $filesock [string trim $quote "\n"] }                incr x            }            close $filesock            putserv "PRIVMSG $chan :Quote $text deleted"        }        proc get {nick uhost hand chan text} {            if {![file exists ${codeninja::quotesys::qfile}]} { putserv "PRIVMSG $chan :No quotes available."                return            }            if {[string trim $text] == ""} {                set filesock [open ${codeninja::quotesys::qfile} r]                set quotes [split [string trimright [read $filesock] "\n"] "\n"]                close $filesock                set qi(id)  [rand [llength $quotes]]                set qi(all) [lindex $quotes $qi(id)]                incr qi(id)                set qi(quote) [lindex $qi(all) 0]                set qi(nick) [lindex $qi(all) 1]                set qi(chan) [lindex $qi(all) 2]                set qi(time) [lindex $qi(all) 3]            } elseif {[regexp {^([0-9]+)$} $text]} {                set filesock [open ${codeninja::quotesys::qfile} r]                set quotes [split [string trimright [read $filesock] "\n"] "\n"]                close $filesock                if {$text &gt; [llength $quotes] || $text &lt; 1} { putserv "PRIVMSG $chan :That quote does not exist" }                set qi(id) $text                set qi(all) [lindex $quotes [expr $text - 1]]                set qi(quote) [lindex $qi(all) 0]                set qi(nick) [lindex $qi(all) 1]                set qi(chan) [lindex $qi(all) 2]                set qi(time) [lindex $qi(all) 3]            } else { putserv "PRIVMSG $chan :Invalid quote ID"                return            }            if {[llength [split $qi(quote) ${codeninja::quotesys::div}]] &gt; 5} { set sendmeth "[pmnot] $nick" } else { set sendmeth "PRIVMSG $chan" }            foreach line [split $qi(quote) ${codeninja::quotesys::div}] {                putserv "$sendmeth :Quote $qi(id): $line"            }            putserv "$sendmeth :Added by $qi(nick) in $qi(chan) on [clock format $qi(time)]"        }        proc find {nick uhost hand chan text} {            if {[string trim $text] == ""} { putserv "PRIVMSG $chan :What do you want to search for?"                return            }            set filesock [open ${codeninja::quotesys::qfile} r]            set quotes [split [string trimright [read $filesock] "\n"] "\n"]            close $filesock            set x 1            set found ""            foreach quote $quotes {                if {[regexp -nocase $text [lindex $quote 0]]} { lappend found $x }                incr x            }            if {$found == ""} { putserv "PRIVMSG $chan :No quotes found"            } elseif {[llength $found] &gt; ${codeninja::quotesys::flimit}} { putserv "PRIVMSG $chan :The following quotes matched your query: [lrange $found 0 [expr ${codeninja::quotesys::flimit} - 1]] (first ${codeninja::quotesys::flimit} shown)"            } else { putserv "PRIVMSG $chan :The following quotes matched your query: $found" }        }        proc last {nick uhost hand chan text} {            set filesock [open ${codeninja::quotesys::qfile} r]            set quotes [split [string trimright [read $filesock] "\n"] "\n"]            close $filesock            set qi(id) [llength $quotes]            set qi(all) [lindex $quotes [expr $qi(id) - 1]]            set qi(quote) [lindex $qi(all) 0]            set qi(nick) [lindex $qi(all) 1]            set qi(chan) [lindex $qi(all) 2]            set qi(time) [clock format [lindex $qi(all) 3]]            if {[llength [split $qi(quote) ${codeninja::quotesys::div}]] &gt; ${codeninja::quotesys::plines}} { set sendmeth "NOTICE $nick" } else { set sendmeth "PRIVMSG $chan" }            foreach line [split $qi(quote) ${codeninja::quotesys::div}] {                putserv "$sendmeth :Quote ${qi(id)}: $line"            }            putserv "$sendmeth :Added by $qi(nick) in $qi(chan) on $qi(time)"        }        proc total {nick uhost hand chan text} {            set filesock [open ${codeninja::quotesys::qfile} r]            set quotes [split [string trimright [read $filesock] "\n"] "\n"]            close $filesock            set total [llength $quotes]            putserv "PRIVMSG $chan :There are $total quotes in my database"        }        proc listauth {nick uhost hand chan text} {            if {$text == ""} { putserv "PRIVMSG $chan :Invalid syntax"                return            }            set filesock [open ${codeninja::quotesys::qfile} r]            set quotes [split [string trimright [read $filesock] "\n"] "\n"]            close $filesock            set match ""            set qid 1            foreach quote $quotes {                if {[string match -nocase [lindex $quote 1] [lindex $text 0]]} {                    lappend match $qid                }                incr qid            }            if {$match == ""} { putserv "PRIVMSG $chan :No quotes found by $text"            } elseif {[llength $match] &gt; ${codeninja::quotesys::flimit}} { putserv "PRIVMSG $chan :$text added the following quotes: [lrange $match 0 [expr ${codeninja::quotesys::flimit} - 1]] (first ${codeninja::quotesys::flimit} shown)"            } else { putserv "PRIVMSG $chan :$text added the following quotes: $match" }        }        proc listchan {nick uhost hand chan text} {            if {$text == ""} { set arg $chan } else { set arg [lindex $text 0] }            set filesock [open ${codeninja::quotesys::qfile} r]            set quotes [split [string trimright [read $filesock] "\n"] "\n"]            close $filesock            set match ""            set qid 1            foreach quote $quotes {                if {[string match -nocase [lindex $quote 2] $arg]} {                    lappend match $qid                }                incr qid            }            if {$match == ""} { putserv "PRIVMSG $chan :No quotes were added in $arg"            } elseif {[llength $match] &gt; ${codeninja::quotesys::plines}} { putserv "PRIVMSG $chan :The following quotes were added in $arg: [lrange $match 0 [expr ${codeninja::quotesys::flimit} - 1]] (first ${codeninja::quotesys::flimit} shown)"            } else { putserv "PRIVMSG $chan :The following quotes were added in $arg: $match" }        }        proc pmnot {} {            if {${codeninja::quotesys::notice} == 1} { return "NOTICE"            } else { return "PRIVMSG" }        }    }}bind pub -|- ${codeninja::quotesys::cmdchar}addquote codeninja::quotesys::addbind pub ${codeninja::quotesys::dflags} ${codeninja::quotesys::cmdchar}delquote codeninja::quotesys::delbind pub -|- ${codeninja::quotesys::cmdchar}quote codeninja::quotesys::getbind pub -|- ${codeninja::quotesys::cmdchar}findquote codeninja::quotesys::findbind pub -|- ${codeninja::quotesys::cmdchar}lastquote codeninja::quotesys::lastbind pub -|- ${codeninja::quotesys::cmdchar}totalquotes codeninja::quotesys::totalbind pub -|- ${codeninja::quotesys::cmdchar}quoteauth codeninja::quotesys::listauthbind pub -|- ${codeninja::quotesys::cmdchar}quotechan codeninja::quotesys::listchanputlog "CodeNinja Quote System ${codeninja::quotesys::ver} loaded" </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10557">Elements</a> — Thu Jan 13, 2011 10:43 am</p><hr />
]]></content>
	</entry>
	</feed>
