| View previous topic :: View next topic |
| Author |
Message |
bradleylauchlin Voice
Joined: 14 Apr 2008 Posts: 6
|
Posted: Mon Apr 14, 2008 8:06 pm Post subject: Looking for a brief history bot. Record and display 10 lines |
|
|
Hi, I am looking to add a script to my bot where it records the last 10 lines from the conversation and then will message, or notice them to a user when they join the channel so that they know what is going on, and are not completely oblivious to the converstation going on as they enter.
I am fairly new to TCL scripting and can do basic stuff, but am not sure how to best approach this. If someone could get me started that would be great. Thanks. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Apr 15, 2008 9:12 am Post subject: |
|
|
| Code: | bind pubm - "#channel *" record:lines
bind join - "#channel *" notice:lines
set last10Lines [list]
proc record:lines {nick uhost hand chan arg} {
global last10Lines
lappend last10Lines "<$nick> $arg"
if {[llength $last10Lines] > 10} {
set last10Lines [lrange $last10Lines end-9 end]
}
}
proc notice:lines {nick uhost hand chan} {
global last10Lines
foreach line $last10Lines {
puthelp "notice $nick :$line"
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
bradleylauchlin Voice
Joined: 14 Apr 2008 Posts: 6
|
Posted: Sat Apr 19, 2008 9:18 pm Post subject: |
|
|
| Thanks, modified it a bit for my bot, and it works perfectly. Thanks for the hand. |
|
| Back to top |
|
 |
|