Code: Select all
foreach line [split $result "\n"] {
puthlp "PRIVMSG $nick :$notc $line"
}
Code: Select all
foreach line [split $result "\n"] {
puthlp "PRIVMSG $nick :$notc $line"
}
Code: Select all
set output "$wordwrap $word"
foreach x [channels] {
putserv "PRIVMSG $x :$output"
}
proc wordwrap {str {len 70} {splitChr { }}} {
set out [set cur {}]; set i 0
foreach word [split [set str][unset str] $splitChr] {
if {[incr i [string len $word]]>$len} {
lappend out [join $cur $splitChr]
set cur [list $word]
set i [string len $word]
} {
lappend cur $word
}
incr i
}
lappend out [join $cur $splitChr]
}
Code: Select all
set output "$wordwrap $word"
Code: Select all
set output [wordwrap $word]
Code: Select all
foreach line [wordwrap $word] {
puthlp "PRIVMSG $chan :$line"
}
1st:Reynaldo wrote:There is another problem, message send, too fast, the bot always quit (excess flood). any idea?i set the char to 250
how to make it delay 5seconds each line?
Code: Select all
############################################################################################################
# If the input came from a msg bind, we set $chan to "privmsg"
# for example:
bind msg - !mytrigger myproc
proc mytrigger {nick uhost hand text} {
# pass the params to 'wrapproc' and set the channelname to "privmsg"
wrapproc $nick $uhost $hand privmsg $text
return
}
bind pub - !mytrigger wrapproc
proc wrapproc {nick uhost hand chan text} {
if {$chan == "privmsg"} {set chan $nick}
# inputtitle would normally be the commandline given with the trigger, such as '!horoscope leo'
# title would be set to 'leo'
# You'd have to do further processing on the $text input of course, to limit its length,
# split it to make it tcl-special char safe, etc.
if {$text != ""} {set inputtitle "$text"} else {set inputtitle "titlefoo"}
# here we grab data into a var, say $sometext, from something like a geturl/regexp operation
set sometext "some real long string of text over 400 chars for example"
# word wrapper
set j 0
set linecount 0
foreach line [split $sometext \n] {
if {$line != ""} {
set len 375
set splitChr " "
set out [set cur {}]; set i 0
foreach word [split $line $splitChr] {
if {[incr i [string len $word]]>$len} {
lappend out [join $cur $splitChr]
set cur [list $word]
set i [string len $word]
incr j
} else {
lappend cur $word
}
incr i
}
lappend out [join $cur $splitChr]
foreach line2 $out {
if {$linecount == 0} {
set line2 [linsert $line2 0 \002[string totitle $inputtitle]\002:]
incr linecount
if {$j >= 1} {
set line2 [linsert $line2 end \002(con't)\002]
set j [expr $j - 1]
}
} else {
set line2 [linsert $line2 0 \002($inputtitle con't)\002]
if {$j >= 1} {
set line2 [linsert $line2 end \002(con't)\002]
set j [expr $j - 1]
}
}
puthelp "PRIVMSG $chan :$line2"
}
}
}
puthelp "PRIVMSG $chan :\[end of $inputtitle output.\]"
}