<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/20098" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2016-02-15T12:26:02-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/20098</id>

		<entry>
		<author><name><![CDATA[CP1832]]></name></author>
		<updated>2016-02-15T12:26:02-04:00</updated>

		<published>2016-02-15T12:26:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104700#p104700</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104700#p104700"/>
		<title type="html"><![CDATA[Backup bot script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104700#p104700"><![CDATA[
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.<div class="codebox"><p>Code: </p><pre><code>#**********## SETTINGS ##**********## main bot identset mainbot "BOT"# main channelset 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 - * botjoinbind part - * botpartbind sign - * botpartproc botjoin {nick uhost hand channel args} {global mainbot mainchannelset 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 mainchannelset ident [string range [lindex [split $uhost @] 0] 1 end]        if {[string match -nocase $ident $mainbot]} {putlog "Joining $mainchannel"channel add $mainchannel}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12450">CP1832</a> — Mon Feb 15, 2016 12:26 pm</p><hr />
]]></content>
	</entry>
	</feed>
