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.

botnet !restart <bot>

Help for those learning Tcl or writing their own scripts.
Post Reply
p
paull
Voice
Posts: 6
Joined: Mon Dec 01, 2008 10:18 am

botnet !restart <bot>

Post by paull »

I am looking for a code to load in the HUB bot in the botnet and will restart a botnick when triggered like !restart <bot> in the HUB channel?

Is this possible?

thanks
p
paull
Voice
Posts: 6
Joined: Mon Dec 01, 2008 10:18 am

Post by paull »

Ok, I got it to work, maybe not the right way but it works. I am a noob at coding so if someone else have a better idea, let me know :)

(HUB bot is in a private channel, so no one else can use this trigger)


In channel with HUB bot: !restart <botnick>

Loaded in HUB bot:

Code: Select all


bind pub o|o !restart pub:restart

set adminchan "#channel"

proc pub:restart { nick uhost hand chan text } {
 global adminchan

   if { $chan == $addminchan } {
      if { $text == "" } {
         putquick "PRIVMSG $addminchan :Use: !restart <botnick> (Option: ALL)"
         return 0
      } else {
         putallbots "!restartbot $text"
         putquick "PRIVMSG $addminchan :Restarting $text..."
      }
  }
}
Loaded in LEAF bots:

Code: Select all


bind bot -|- !restartbot restartbot

proc restartbot { from command text } {
       if { $text == "LEAF1" || $text == "ALL" } {
          restart
 }
}
Btw I dont know when to use:

Code: Select all

    { $text == "LEAF1" }  
or 
    { $text eq "LEAF1" }
Maybe someone can tell me the difference?

thanks
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Read The difference between eq and ==.

So, since you're comparing strings, it's recommended to use "eq" (unless your Tcl version is older than 8.4).
Post Reply