This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
-
TeRRaNoVA
- Voice
- Posts: 10
- Joined: Mon May 16, 2005 6:32 pm
Post
by TeRRaNoVA »
hello,
i want my bot to read the latest 1 or 5 lines from bot.log file en msg them to #channel ...
thx!
-
Sir_Fz
- Revered One
- Posts: 3794
- Joined: Sun Apr 27, 2003 3:10 pm
- Location: Lebanon
-
Contact:
Post
by Sir_Fz »
A
forum search will return exactly what you've asked for.
-
TeRRaNoVA
- Voice
- Posts: 10
- Joined: Mon May 16, 2005 6:32 pm
Post
by TeRRaNoVA »
thx
founded this and it works bud....
Code: Select all
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..:/
-
Sir_Fz
- Revered One
- Posts: 3794
- Joined: Sun Apr 27, 2003 3:10 pm
- Location: Lebanon
-
Contact:
Post
by Sir_Fz »
Code: Select all
bind pub - !cmd cmd
proc cmd {nick uhost hand chan arg} {
# !cmd triggers this procedure.
}
-
DragnLord
- Owner
- Posts: 711
- Joined: Sat Jan 24, 2004 4:58 pm
- Location: C'ville, Virginia, USA
Post
by DragnLord »
TeRRaNoVA wrote:thx
founded this and it works bud....
Code: Select all
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: Select all
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
-
TeRRaNoVA
- Voice
- Posts: 10
- Joined: Mon May 16, 2005 6:32 pm
Post
by TeRRaNoVA »
Sir_Fz wrote:Code: Select all
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
-
Sir_Fz
- Revered One
- Posts: 3794
- Joined: Sun Apr 27, 2003 3:10 pm
- Location: Lebanon
-
Contact:
Post
by Sir_Fz »
You load it the same way you load any another Tcl script.
-
TeRRaNoVA
- Voice
- Posts: 10
- Joined: Mon May 16, 2005 6:32 pm
Post
by TeRRaNoVA »
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: Select all
bind pub - !cmd cmd
proc cmd {nick uhost hand chan arg} {
# !cmd triggers this procedure.
}
-
demond
- Revered One
- Posts: 3073
- Joined: Sat Jun 12, 2004 9:58 am
- Location: San Francisco, CA
-
Contact:
Post
by demond »
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
-
DragnLord
- Owner
- Posts: 711
- Joined: Sat Jan 24, 2004 4:58 pm
- Location: C'ville, Virginia, USA
Post
by DragnLord »
ah, I missed the fileevent calling procedure foo

must have been a long day
-
Sir_Fz
- Revered One
- Posts: 3794
- Joined: Sun Apr 27, 2003 3:10 pm
- Location: Lebanon
-
Contact:
Post
by Sir_Fz »
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: Select all
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: Select all
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]"}
-
TeRRaNoVA
- Voice
- Posts: 10
- Joined: Mon May 16, 2005 6:32 pm
Post
by TeRRaNoVA »
thx Working 110% now
thx for your help!