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.

Putbot problem

Old posts that have not been replied to for several years.
Locked
B
Buffy_25
Halfop
Posts: 63
Joined: Sat Nov 22, 2003 6:36 am

Putbot problem

Post by Buffy_25 »

Hi,

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.

Best regards,
Buffy
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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
User avatar
TALES
Halfop
Posts: 59
Joined: Sun Nov 09, 2003 8:45 am
Location: Netherlands
Contact:

Post by TALES »

This looks a little insecure

Code: Select all

if {$nick == "bot2"} {
maybe some more check before sending the file

Code: Select all

if {$nick =="bot2" && [matchattr $hand b] && [islinked $hand]} {
im not shure about islinked $hand maybe someone else could give advice on that one.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Use an "lower case" check like [string tolower $nick] == "bot2"
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

TALES wrote:im not shure about islinked $hand maybe someone else could give advice on that one.
always check Tcl-commands.doc:
islinked <bot>
Returns: 1 if the bot is currently linked; 0 otherwise
Module: core
I guess you shouldn't use $hand on islinked.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Yes, it's correct the "islinked $hand"
Once the game is over, the king and the pawn go back in the same box.
B
Buffy_25
Halfop
Posts: 63
Joined: Sat Nov 22, 2003 6:36 am

Post by Buffy_25 »

Hi,

Thnx for your replies!

So i can do it like this:

For bot1:

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
}


Any further help is appreciated.

Thnx a lot.

Best regards,

Buffy
Locked