egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Backup bot script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
CP1832
Halfop


Joined: 09 Oct 2014
Posts: 68

PostPosted: Mon Feb 15, 2016 12:26 pm    Post subject: Backup bot script Reply with quote

I've got two identical bots running the same scripts with the same settings. I've created this simple script for the backup bot to join the mainchannel in case the main bot goes down for some reason and to leave the channel when the main bot joins the channel. For this script to work, both bots have to be in a channel together (I've added them both to a secondary channel that's unused). I'm checking the ident as the main bot is authed, since the auth might fail and change the bot's nick, I check the ident.
Code:
#**********#
# SETTINGS #
#**********#

# main bot ident
set mainbot "BOT"

# main channel
set mainchannel "#channel"

#************************#
# DO NOT EDIT UNDERNEATH #
#************************#
putlog "main-backup.tcl"

foreach bind [binds botjoin] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
foreach bind [binds botpart] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}

bind join - * botjoin
bind part - * botpart
bind sign - * botpart

proc botjoin {nick uhost hand channel args} {
global mainbot mainchannel
   set ident [string range [lindex [split $uhost @] 0] 1 end]
        if {[string match -nocase $ident $mainbot]} {
         putlog "Leaving $mainchannel"
         channel remove $mainchannel
   }
}

proc botpart {nick uhost hand channel args} {
global mainbot mainchannel
   set ident [string range [lindex [split $uhost @] 0] 1 end]
        if {[string match -nocase $ident $mainbot]} {
         putlog "Joining $mainchannel"
         channel add $mainchannel
   }
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber