| View previous topic :: View next topic |
| Author |
Message |
TeRRaNoVA Voice
Joined: 16 May 2005 Posts: 10
|
Posted: Tue Apr 18, 2006 6:06 pm Post subject: request msg script! |
|
|
hello,
i want my bot to read the latest 1 or 5 lines from bot.log file en msg them to #channel ...
thx! |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
TeRRaNoVA Voice
Joined: 16 May 2005 Posts: 10
|
Posted: Tue Apr 18, 2006 7:06 pm Post subject: |
|
|
thx
founded this and it works bud....
| Code: | set f [open "|tail -f /home/user/eggdrop/logs/bot.log"]
fconfigure $f -blocking 0 -buffering line
fileevent $f readable [list foo $f]
proc foo {f} {puthelp "privmsg #mychannel :[gets $f]"} |
bud now i want a !cmd for latest 5 lines from that bot.log
can you help me with is have seach bud no good result..:/ |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Apr 18, 2006 8:04 pm Post subject: |
|
|
| Code: | bind pub - !cmd cmd
proc cmd {nick uhost hand chan arg} {
# !cmd triggers this procedure.
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Tue Apr 18, 2006 8:13 pm Post subject: |
|
|
| TeRRaNoVA wrote: | thx
founded this and it works bud....
| Code: | set f [open "|tail -f /home/user/eggdrop/logs/bot.log"]
fconfigure $f -blocking 0 -buffering line
fileevent $f readable [list foo $f]
proc foo {f} {puthelp "privmsg #mychannel :[gets $f]"} |
bud now i want a !cmd for latest 5 lines from that bot.log
can you help me with is have seach bud no good result..:/ |
How in the world can that procedure code work???
Far easier:
| Code: |
proc foo {n u h c t} {
set file [exec tail -n5 /path/to/log]
foreach line in $file {
putserv "PRIVMSG $c : $line"
}
}
|
might not work for windrop, but you used tail in your example so it should work for you |
|
| Back to top |
|
 |
TeRRaNoVA Voice
Joined: 16 May 2005 Posts: 10
|
Posted: Wed Apr 19, 2006 6:51 am Post subject: |
|
|
| Sir_Fz wrote: | | Code: | bind pub - !cmd cmd
proc cmd {nick uhost hand chan arg} {
# !cmd triggers this procedure.
} |
|
does that trigger directly from /home/user/eggdrop/logs/bot.log
or were to put into a new .tcl ... ?
sorry for my bad english |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Apr 19, 2006 6:12 pm Post subject: |
|
|
You load it the same way you load any another Tcl script. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
TeRRaNoVA Voice
Joined: 16 May 2005 Posts: 10
|
Posted: Thu Apr 20, 2006 3:10 pm Post subject: |
|
|
| Sir_Fz wrote: | | You load it the same way you load any another Tcl script. |
load this as cmd.tcl bud when i type !cmd nothing happens or `m wrong..
| Code: | bind pub - !cmd cmd
proc cmd {nick uhost hand chan arg} {
# !cmd triggers this procedure.
} |
|
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Apr 21, 2006 12:03 am Post subject: |
|
|
| DragnLord wrote: |
How in the world can that procedure code work???
|
bizarre quantum forces make it do so  _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Fri Apr 21, 2006 12:20 am Post subject: |
|
|
ah, I missed the fileevent calling procedure foo
must have been a long day |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Apr 21, 2006 7:47 am Post subject: |
|
|
| TeRRaNoVA wrote: | | Sir_Fz wrote: | | You load it the same way you load any another Tcl script. |
load this as cmd.tcl bud when i type !cmd nothing happens or `m wrong..
| Code: | bind pub - !cmd cmd
proc cmd {nick uhost hand chan arg} {
# !cmd triggers this procedure.
} |
|
I gave you an example on how you can make the bot trigger a procedure on pub command.
| Code: | bind pub - !cmd cmd
proc cmd {nick uhost hand chan arg} {
set f [open "|tail -f /home/user/eggdrop/logs/bot.log"]
fconfigure $f -blocking 0 -buffering line
fileevent $f readable [list foo $f $chan]
}
proc foo {f c} {puthelp "privmsg $c :[gets $f]"} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
TeRRaNoVA Voice
Joined: 16 May 2005 Posts: 10
|
Posted: Sat Apr 22, 2006 5:07 pm Post subject: |
|
|
thx Working 110% now
thx for your help! |
|
| Back to top |
|
 |
|