I have two bots in my channel. Bot1 and Bot2 (on two different shells)
When one is connected, and the second one connects to the network, they get linked immidiately (botattr +h).
What i would like to do:
I have on bot1 some information in txt file, that i would like to transfer to bot2 when bot2 connects to the channel.
For bot1 i have the following:
bind join - * detect:bot
proc detect:bot {nick uhost hand chan} {
if {$nick == "bot2"} {
timer 45 {
set file [open /usr/home/account/eggdrop/logs/user.txt r]
set buf [read $file]
foreach line [split $buf \n] {
set line [string trim $line " "]
if {$line == ""} {continue}
putallbots !Transferuserinfo $line
}
set file [open /usr/home/account/eggdrop/logs/ftp.txt r]
set buf1 [read $file]
foreach line [split $buf1 \n] {
set line [string trim $line " "]
if {$line == ""} {continue}
putallbots !Transferftpinfo $line
}
timer 60 { file delete /usr/home/account/eggdrop/logs/user.txt
file delete /usr/home/account/eggdrop/logs/ftp.txt }
}
}
}
For my bot2 i have the following:
bind bot - "!Transferftpinfo" ftp:transferinfo
bind bot - "!Transferuserinfo" user:transferinfo
proc ftp:transerinfo {botnick command arg} {
set file [open /home/account/eggdrop/logs/ftpsuptime.txt a+]
puts $file "$arg"
close $file
}
proc user:transerinfo {botnick command arg} {
set file [open /home/account/eggdrop/logs/usersuptime.txt a+]
puts $file "$arg"
close $file
}
I tried this, and i get no response at all...and no errors. Is there something wrong with it?
Additionaly, Is this the right way to transfer txt info from one bot to the other one?
Thnx in advance.
I don't read all your tcl, put reading a file line per line and transmit it is quite slow...
why don't you use dcc and file transfert components?
get a local copy of your file by a file transfert, and then append the copy to your main file...
And be carrefull:
you have bind bot - "!Transferftpinfo" ftp:transferinfo
bind bot - "!Transferuserinfo" user:transferinfo
and next lines are proc ftp:transerinfo {botnick command arg} {
proc user:transerinfo {botnick command arg} {
transferinfo != transerinfo , a "f" is missing
bind join - * detect:bot
proc detect:bot {nick uhost hand chan}
if {islinked <bot2 names>} {
if {info exists exists /usr/home/account/eggdrop/logs/usersbackup.txt} {
dccsend /usr/home/account/eggdrop/logs/usersbackup.txt <botname on botlist>
}
}
For my bot2, i can do the following then:
bind rcvd - * got:file
proc got:file {hand nick path} {
-> i will need to move this file to /usr/home/account2/eggdrop/logs/ Any help appreciated
-> i need to append this txt file, to the existing txt file in \logs on my bot2 (existing file = usersuptime.txt) Any help appreciated
file delete /usr/home/account2/eggdrop/logs/usersbackup.txt
}