<?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/16482" />

	<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>2009-01-21T01:57:31-04:00</updated>

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

		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-17T20:28:16-04:00</updated>

		<published>2009-01-17T20:28:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86972#p86972</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86972#p86972"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86972#p86972"><![CDATA[
Ok, I updated/fixed the botnet code some (rev1.2), and added it to rss-synd 0.5b1 as an example, untested but it should work (it loads at least <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz">)<br><br>Demonds RSS News 2.2 + botnet code:<br><a href="http://incith.com/eggdrop/rssnews2.2-botnet.tcl" class="postlink">http://incith.com/eggdrop/rssnews2.2-botnet.tcl</a><br><br>RSS Synd 0.5b1 + botnet code:<br><a href="http://incith.com/eggdrop/rss-synd-05b1-botnet.tcl" class="postlink">http://incith.com/eggdrop/rss-synd-05b1-botnet.tcl</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Sat Jan 17, 2009 8:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[wac]]></name></author>
		<updated>2009-01-13T00:38:24-04:00</updated>

		<published>2009-01-13T00:38:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86895#p86895</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86895#p86895"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86895#p86895"><![CDATA[
I use rss-synd<br><br><a href="http://forum.egghelp.org/viewtopic.php?t=11277" class="postlink">http://forum.egghelp.org/viewtopic.php?t=11277</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8485">wac</a> — Tue Jan 13, 2009 12:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-17T20:29:54-04:00</updated>

		<published>2009-01-12T20:01:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86888#p86888</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86888#p86888"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86888#p86888"><![CDATA[
It's all the same.. it would check it's priority on the botnet, and decide whether or not to announce or check any rss feeds at all.<br><br>I'll post a modified version of (demonds rss script? do you use a different one?) in a bit, just going out at the moment.<br><br>Demonds RSS News 2.2 + botnet code:<br><a href="http://incith.com/eggdrop/rssnews2.2-botnet.tcl" class="postlink">http://incith.com/eggdrop/rssnews2.2-botnet.tcl</a><br><br>RSS Synd 0.5b1 + botnet code:<br><a href="http://incith.com/eggdrop/rss-synd-05b1-botnet.tcl" class="postlink">http://incith.com/eggdrop/rss-synd-05b1-botnet.tcl</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Mon Jan 12, 2009 8:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[wac]]></name></author>
		<updated>2009-01-12T19:30:55-04:00</updated>

		<published>2009-01-12T19:30:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86885#p86885</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86885#p86885"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86885#p86885"><![CDATA[
hehe didn't take it as arguing <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> but yeah it would work for the tvrage script (I assume), but for rss not sure since it announces every so often, whenever the feed updates, so I'm not sure how that would fit in <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8485">wac</a> — Mon Jan 12, 2009 7:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-11T18:34:40-04:00</updated>

		<published>2009-01-11T18:34:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86867#p86867</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86867#p86867"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86867#p86867"><![CDATA[
(not arguing or anything, just proposing uses for the code).. It could still be adapted for those scripts, e.g., if &lt;leaf_bot&gt; is not first or etc, just return, don't fetch any data or etc, don't run the timers, just return again.. ah well. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>I am including it in my future releases, for whatever purpose, my scripts are/will be <em class="text-italics">botnet compatible</em>, lol.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Sun Jan 11, 2009 6:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[wac]]></name></author>
		<updated>2009-01-11T18:04:32-04:00</updated>

		<published>2009-01-11T18:04:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86864#p86864</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86864#p86864"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86864#p86864"><![CDATA[
Yeah makes sense<br><br>probably overloaded from the more intensive scripts like tvrage and an rss feed with several feeds...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8485">wac</a> — Sun Jan 11, 2009 6:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-11T15:19:08-04:00</updated>

		<published>2009-01-11T15:19:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86858#p86858</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86858#p86858"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86858#p86858"><![CDATA[
Strange that your bot would get overloaded, on the one hand the above code should help in the sense that, if it gets an incoming message, and it is not the 'active' bot, it will just return.<br><br>More appropriate uses of the above code would be for channel security based scripts, so if one bot dies, another one can still have a go.<br><br>To be honest this code just came from sitting there going, "why can't my bots realise that another bot is going to serve this request?"... I wanted to fix that.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Sun Jan 11, 2009 3:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[wac]]></name></author>
		<updated>2009-01-11T01:04:02-04:00</updated>

		<published>2009-01-11T01:04:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86855#p86855</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86855#p86855"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86855#p86855"><![CDATA[
np, I hadn't tried it yet, but it looks interesting, I actually divided up the script s I had running onto several bots because it was causing the bot to become unresponsive, so it wouldn't really work for me to have them all together again, but I guess if I had several more they could do backup for the bot that does it mainly, but that'd be a bit much just to keep the script alive... <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8485">wac</a> — Sun Jan 11, 2009 1:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-08T01:40:45-04:00</updated>

		<published>2009-01-08T01:40:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86785#p86785</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86785#p86785"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86785#p86785"><![CDATA[
Fixed to be more readable, thanks.  The above hasn't really changed at all, it does really work quite well at allowing only 1 bot to respond to a trigger at a time.  Kind of like giving yourself "backup" bots, so if one goes down, you can still have your !triggers working on another bot.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Thu Jan 08, 2009 1:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[wac]]></name></author>
		<updated>2009-01-07T19:24:26-04:00</updated>

		<published>2009-01-07T19:24:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86781#p86781</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86781#p86781"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86781#p86781"><![CDATA[
interesting looking script, just thought I should point out that using two similar looking names is confusing, you should try something like hub1, leaf1, leaf2 and so on, even if that's not what they actually are, heck even bot1, bot2, bot3 would work, just a simple glance at what you wrote for your example is kinda confusing... good work on the script though...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8485">wac</a> — Wed Jan 07, 2009 7:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-21T01:57:31-04:00</updated>

		<published>2008-12-29T16:16:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86593#p86593</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86593#p86593"/>
		<title type="html"><![CDATA[Code for botnet to run same script (Rev 1.4)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86593#p86593"><![CDATA[
Hard to describe what I mean in the topic.  Basically, 2+ bots can all load the same script, and activate it, and only 1 of them will service the request.  If that bot drops, the next one in line will start servicing the requests.  I chose not to bind bot_disc by default as it will work better this way I think.  Consider if a bot just gets .unlinked, only one will keep serving requests if bot_disc isn't called, until the other bot is truly gone (leaves the channel).  If bot_disc is enabled, as soon as a bot leaves the partyline, a new bot will start serving requests, but if the old bot isn't actually timing out or disconnecting (just unlinked), then 2 bots will start serving requests.  Hope that makes sense.  Maybe a check in bot_disc, loop through all the channels the bot is on, and check for the disconnecting bot in them, if the bot is disconnecting + not found, then remove them?<br><br><br>Example of what this code does (visitant is the hub, leaftant and another_leaf are leafs):<blockquote class="uncited"><div>(visitant, another_leaf, and leaftant are all in the same channel)<br><br>(10:32:18) &lt;@incith&gt; !layout <a href="http://incith.com" class="postlink">http://incith.com</a><br>(10:32:18) &lt;@visitant&gt; URL: <a href="http://incith.com/" class="postlink">http://incith.com/</a> \\ TITLE: incith.com =&gt; main menu<br>(10:32:24) +|+ visitant has quit [Client Quit]<br><br>(10:32:33) &lt;@incith&gt; !layout <a href="http://incith.com" class="postlink">http://incith.com</a><br>(10:32:35) &lt;@another_leaf&gt; URL: <a href="http://incith.com/" class="postlink">http://incith.com/</a> \\ TITLE: incith.com =&gt; main menu<br>(10:33:01) +|+ another_leaf has quit [Client Quit]<br><br>(10:33:03) &lt;@incith&gt; !layout <a href="http://incith.com" class="postlink">http://incith.com</a><br>(10:33:05) &lt;@leaftant&gt; URL: <a href="http://incith.com/" class="postlink">http://incith.com/</a> \\ TITLE: incith.com =&gt; main menu</div></blockquote>1.4: Apparently if botnet-nick does not exist in your conf file, it is not set until after everything is sourced, so I've accounted for this in the startup portion of the botnet code now.  Heh, it also seems I forgot to paste a line in here in startup too.<br>1.3: removed the 'unbind' else area.  Oops.<br>1.2: Found some bugs in 1.1, cleaned it up.  Putlogs being sent when they shouldn't be and bots being added to the static array unnecessarily.  Whether you choose to bind disc or not I leave up to the authors.<br><br>In your scripts startup, add the below.  This initializes an array to remember certain things going on.  I use [clock seconds] in order to decide which bot is 'first'.<div class="codebox"><p>Code: </p><pre><code>namespace eval incith::layout {  variable botnet 1  variable debug 0  variable version {r79}  global botnet-nick nick  if {${botnet-nick} == ""} { set botnet-nick ${nick} }  array set static {}  if {${incith::layout::botnet} &gt;= 1} {    set static(botnet,${botnet-nick},time) [clock seconds]  } else {    set static(botnet,${botnet-nick},time) "noswarm"  }  if {![info exists static(botnet,bots)]} {    set static(botnet,bots) ${botnet-nick}  }}</code></pre></div>You will need to bind bot, link, and optionally disc.  bind bot works by receiving a message starting with its 'bind', in this case "incith:layout".  So any [putallbots "incith:layout *"] messages will be picked up by this.<div class="codebox"><p>Code: </p><pre><code># bind the botnet bindsif {${incith::layout::botnet} &gt;= 1} {  bind bot - incith:layout incith::layout::bot_msg  bind link - * incith::layout::bot_link  # it really depends what works better for you, checking if  # the bot is onchan or just making sure they are linked.  # bind disc - * incith::layout::bot_disc}</code></pre></div>And add the actual procedures that we are binding to:<div class="codebox"><p>Code: </p><pre><code>namespace eval incith::layout {  proc bot_msg {from cmd text} {    upvar #0 incith::layout::static static    if {${incith::layout::debug} &gt;= 1} {      putlog "${incith::layout::version} (botmsg): &lt;${from}&gt; ${cmd} ${text}"    }    # receiving a bots load time    if {[string match "time ?*" $text]} {      regexp -- {time (.*)} $text - time      set static(botnet,${from},time) $time      # make sure this bot is in our bot list      if {![string match "*${from}*" $static(botnet,bots)]} {        putlog "${incith::layout::version} (botnet): ${from} has joined the incith:layout swarm."        append static(botnet,bots) ";${from}"        regsub -all -- {;;} $static(botnet,bots) {;} static(botnet,bots)        set static(botnet,bots) [string trimright $static(botnet,bots) {;}]      }    }  }  proc bot_link {bot hub} {    global botnet-nick    upvar #0 incith::layout::static static    # send our time to the bots    putallbots "incith:layout time $static(botnet,${botnet-nick},time)"  }  proc bot_disc {bot} {    upvar #0 incith::layout::static static    if {[string match "*${bot}*" $static(botnet,bots)]} {      if {$static(botnet,${bot},time) != "noswarm"} {        putlog "${incith::layout::version} (botnet): ${bot} has left the incith:layout swarm."      }    }    # remove this bot from our bot list.  If they were merely unlinked    # then this code will make it all fail.  They can be unlinked and still    # serve seperately since the time will be stored, and they'd have to    # leave the channel additionally before another bot takes over.    regsub -all -- $bot $static(botnet,bots) {} static(botnet,bots)    regsub -all -- {;;} $static(botnet,bots) {;} static(botnet,bots)    set static(botnet,bots) [string trimright $static(botnet,bots) {;}]    # remove their time?  If they just lost link, they might still be [onchan]    # unset static(botnet,${bot},time)  }}</code></pre></div>And then in your message handler (your proc receiving input), add something like the below (NOTE: This should only be for public (bind pub) messages.  If a specific bot receives a private message, they should serve it as normal, as it cannot exactly pass off private messages to another bot.  And that would be silly anyway.<div class="codebox"><p>Code: </p><pre><code>namespace eval incith::layout {  proc some_public_procedure {nick uhand hand chan input} {    global botnet-nick    upvar #0 incith::layout::static static    set input(where) $chan    # botnet    if {${incith::layout::botnet} &gt;= 1 &amp;&amp; $input(where) != "private"} {      foreach bot [split $static(botnet,bots) ";"] {        # skip ourselves, bots not on the input channel, and bots not participating        if {${bot} == ${botnet-nick} || ![onchan ${bot} $input(where)] || $static(botnet,${bot},time) == "noswarm"} {          continue        # bots that load first will serve first.  change &lt; to &gt; to reverse.        } elseif {$static(botnet,${bot},time) &lt; $static(botnet,${botnet-nick},time)} {          if {${incith::layout::debug} &gt;= 1} {            putlog "${incith::layout::version} (botnet): $bot loaded before me."          }          return        # should 2 bots have the same time, set a new random time (this did happen in testing)        } elseif {$static(botnet,${bot},time) == $static(botnet,${botnet-nick},time)} {          if {${incith::layout::debug} &gt;= 1} {            putlog "${incith::layout::version} (botnet): $bot had the same load time as me, fixing."          }          set static(botnet,${botnet-nick},time) [expr [clock seconds] + int(rand()*60)+1]          putallbots "incith:layout time $static(botnet,${botnet-nick},time)"          return        }      }      # looks like we're serving, make sure we keep the botnet up to date      putallbots "incith:layout time $static(botnet,${botnet-nick},time)"    }  }}</code></pre></div>And I add this at the end of the script, before the 'putlog "loaded"' type line.  This will send the time out to the botnet on a .rehash etc, in case you modify a bots config to be removed from the swarm etc.<div class="codebox"><p>Code: </p><pre><code>namespace eval incith::layout {  putallbots "incith:layout time $static(botnet,${botnet-nick},time)"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Mon Dec 29, 2008 4:16 pm</p><hr />
]]></content>
	</entry>
	</feed>
