okay I'm currently running over 30+ bMotion bots with help of some friends but were not online 24 / 7 and that is why im asking if a script could be made o.o!
All bots currently idle in #Eggs on an IRC server (Which is unimportant so i wont state it) and we want users to pic their own bots. So i had an idea to get a script that users can make a bot join. Basicly a user join's #Eggs and says !join [Bot-Name] channel if no Bot-Name is specified than a random bot joins, but when the bot joins it checks with users of the channel and if theres more than 2 bots alreaddy in the channel it just joined, the bot would automaticly part. all bots are halfop in #Eggs.
Our old script idea was that we join the bots to the channel with the telnet session a script automacticly parts with 2 bots in the channel sensing via the botnet but our botnet uptime is terrible thats how i came up with the idea to whois a halfop in #Eggs see if that halfop in #Eggs is in #NEWCHANNEL.
-End of idea.
We were running a on-invite script that any user can invite any bot and they could all join and all set +bmotion upon joining and would spam, here's the old code -
Try this. Limited testing done already. READ what it says.
Your idea of simultaneously sending a network /whois to multiple users then capturing all the appropriate raw responses is not good. Quite apart from the difficulty, it potentially floods the IRCD.
# invitebot.tcl
# uses a command bot to send msg to another bot from a preconfigured list to join a channel
# bot will part the new channel if too many bots there already
# same script with same configuration must be loaded on ALL bots
# includes command bot AND all bots in preconfigured list below
### ----------------------------------------- ###
### ---------- SYNTAX ----------------------- ###
# assuming default command trigger !
# !join ?botname? <#channelname>
# <#channelname> must be specified
# if ?botname? is not specified, one is chosen at random from the preconfigured list
# if ?botname? is specified, it must be one from the preconfigured list
### ----------------------------------------- ###
### ---------- CONFIGURATION ---------------- ###
# set here the single character command trigger
set vInviteBotTrigger !
# set here the bot flag(s) required to use commands
set vInviteBotFlags n
# set here the command channel
set vInviteBotCommandChan "#Atlantis"
# set here the name of the command bot
# it should not be one of the bots listed bellow in vInviteBotBotnet
# the command bot does not need to be in the new channel
set vInviteBotCommandBot "osmosis"
# set here a list of the bots that can be commanded to join a new channel
# the list should not include the command bot as set above in vInviteBotCommandBot
set vInviteBotBotnet {
"Baal"
"Heracles"
"McKay"
"gormless"
"ZeroPointModule"
}
# set here the maximum number of bots from vInviteBotBotnet that can reside in a new channel
# does not effect the numbers in the command channel
set vInviteBotMaxBots 2
### ----------------------------------------- ###
### ---------- CODE ------------------------- ###
proc pInviteBotTrigger {} {
global vInviteBotTrigger
return $vInviteBotTrigger
}
bind PUB - [pInviteBotTrigger]join pInviteBotJoinCommand
proc pInviteBotJoinCommand {nick uhost hand chan text} {
global vInviteBotBotnet vInviteBotCommandChan vInviteBotCommandBot vInviteBotFlags
if {[isbotnick $vInviteBotCommandBot]} {
if {[string equal -nocase $vInviteBotCommandChan $chan]} {
if {[matchattr $hand $vInviteBotFlags]} {
set arguments [split [string trim $text]]
switch -- [llength $arguments] {
1 {
set botname [lindex $vInviteBotBotnet [rand [llength $vInviteBotBotnet]]]
putquick "PRIVMSG $chan :($nick) Randomly selected bot $botname"
set channel [string trim $text]
}
2 {
set botname [lindex $arguments 0]
set channel [lindex $arguments 1]
}
default {
putserv "PRIVMSG $chan :($nick) -error- correct syntax is [pInviteBotTrigger]join <botname> <#channel>"
return 0
}
}
if {[lsearch -exact [string tolower $vInviteBotBotnet] [string tolower $botname]] != -1} {
if {[regexp -- {^#} $channel]} {
if {[onchan $botname $chan]} {
putquick "PRIVMSG $chan :($nick) Sending JOIN command to $botname"
putserv "PRIVMSG $botname :JOIN $channel"
} else {putserv "PRIVMSG $chan :($nick) -error- $botname is not on the command channel"}
} else {putserv "PRIVMSG $chan :($nick) -error- $channel is not a valid channel name"}
} else {putserv "PRIVMSG $chan :($nick) -error- $botname was not found in my botnet list"}
}
}
}
return 0
}
bind MSG - JOIN pInviteBotMsgReceive
proc pInviteBotMsgReceive {nick uhost hand text} {
global vInviteBotCommandChan vInviteBotCommandBot
if {[string equal -nocase $vInviteBotCommandBot $nick]} {
if {[llength [split $text]] == 1} {
if {[regexp -- {^#} $text]} {
if {![validchan $text]} {
putquick "PRIVMSG $vInviteBotCommandChan :Received JOIN command from $nick, joining $text"
channel add $text
utimer 10 [list pInviteBotCheckUsers $text]
} else {putquick "PRIVMSG $vInviteBotCommandChan :Ignoring JOIN command from $nick, already monitoring $text"}
}
}
}
return 0
}
proc pInviteBotCheckUsers {chan} {
global vInviteBotBotnet vInviteBotCommandChan vInviteBotMaxBots
if {([botonchan $chan]) && ([llength [set users [chanlist $chan]]] != 0)} {
set count 0
foreach person $users {
if {[lsearch -exact [string tolower $vInviteBotBotnet] [string tolower $person]] != -1} {
incr count
}
}
if {$count > $vInviteBotMaxBots} {
putquick "PRIVMSG $vInviteBotCommandChan :Too many bots already in $chan, parting"
channel remove $chan
} else {putquick "PRIVMSG $vInviteBotCommandChan :JOIN confirmed, $count bot(s) detected"}
} else {
putquick "PRIVMSG $vInviteBotCommandChan :Failed to retrieve channel list for $chan, parting"
if {[validchan $chan]} {
channel remove $chan
}
}
return 0
}
# eof
** edited ** at 3:45pm ... take the latest version above
I can't immediately see why you would be getting that error if you have correctly configured the script. The statement using vInviteBotFlags looks fine and the variable is correctly defined as global. Unless you have made changes to the script? It seems strange that the script worked for you in the first place then later gave that error.
However, the statement using vInviteBotFlags has been taken out of the proc and bot flags instead tested in the bind statement. As per the following code.
btw If you get Tcl errors, please ensure that you have .set and .tcl commands enabled and in the partyline do .set errorInfo
# invitebot.tcl
# uses a command bot to send msg to another bot from a preconfigured list to join a channel
# bot will part the new channel if too many bots there already
# same script with same configuration must be loaded on ALL bots
# includes command bot AND all bots in preconfigured list below
### ----------------------------------------- ###
### ---------- SYNTAX ----------------------- ###
# assuming default command trigger !
# !join ?botname? <#channelname>
# <#channelname> must be specified
# if ?botname? is not specified, one is chosen at random from the preconfigured list
# if ?botname? is specified, it must be one from the preconfigured list
### ----------------------------------------- ###
### ---------- CONFIGURATION ---------------- ###
# set here the single character command trigger
set vInviteBotTrigger !
# set here the bot flag(s) required to use commands
set vInviteBotFlags n
# set here the command channel
set vInviteBotCommandChan "#Atlantis"
# set here the name of the command bot
# it should not be one of the bots listed bellow in vInviteBotBotnet
# the command bot does not need to be in the new channel
set vInviteBotCommandBot "osmosis"
# set here a list of the bots that can be commanded to join a new channel
# the list should not include the command bot as set above in vInviteBotCommandBot
set vInviteBotBotnet {
"Baal"
"Heracles"
"McKay"
"gormless"
"ZeroPointModule"
}
# set here the maximum number of bots from vInviteBotBotnet that can reside in a new channel
# does not effect the numbers in the command channel
set vInviteBotMaxBots 2
### ----------------------------------------- ###
### ---------- CODE ------------------------- ###
proc pInviteBotTrigger {} {
global vInviteBotTrigger
return $vInviteBotTrigger
}
bind PUB $vInviteBotFlags [pInviteBotTrigger]join pInviteBotJoinCommand
proc pInviteBotJoinCommand {nick uhost hand chan text} {
global vInviteBotBotnet vInviteBotCommandChan vInviteBotCommandBot
if {[isbotnick $vInviteBotCommandBot]} {
if {[string equal -nocase $vInviteBotCommandChan $chan]} {
set arguments [split [string trim $text]]
switch -- [llength $arguments] {
1 {
set botname [lindex $vInviteBotBotnet [rand [llength $vInviteBotBotnet]]]
putquick "PRIVMSG $chan :($nick) Randomly selected bot $botname"
set channel [string trim $text]
}
2 {
set botname [lindex $arguments 0]
set channel [lindex $arguments 1]
}
default {
putserv "PRIVMSG $chan :($nick) -error- correct syntax is [pInviteBotTrigger]join <botname> <#channel>"
return 0
}
}
if {[lsearch -exact [string tolower $vInviteBotBotnet] [string tolower $botname]] != -1} {
if {[regexp -- {^#} $channel]} {
if {[onchan $botname $chan]} {
putquick "PRIVMSG $chan :($nick) Sending JOIN command to $botname"
putserv "PRIVMSG $botname :JOIN $channel"
} else {putserv "PRIVMSG $chan :($nick) -error- $botname is not on the command channel"}
} else {putserv "PRIVMSG $chan :($nick) -error- $channel is not a valid channel name"}
} else {putserv "PRIVMSG $chan :($nick) -error- $botname was not found in my botnet list"}
}
}
return 0
}
bind MSG - JOIN pInviteBotMsgReceive
proc pInviteBotMsgReceive {nick uhost hand text} {
global vInviteBotCommandChan vInviteBotCommandBot
if {[string equal -nocase $vInviteBotCommandBot $nick]} {
if {[llength [split $text]] == 1} {
if {[regexp -- {^#} $text]} {
if {![validchan $text]} {
putquick "PRIVMSG $vInviteBotCommandChan :Received JOIN command from $nick, joining $text"
channel add $text
utimer 10 [list pInviteBotCheckUsers $text]
} else {putquick "PRIVMSG $vInviteBotCommandChan :Ignoring JOIN command from $nick, already monitoring $text"}
}
}
}
return 0
}
proc pInviteBotCheckUsers {chan} {
global vInviteBotBotnet vInviteBotCommandChan vInviteBotMaxBots
if {([botonchan $chan]) && ([llength [set users [chanlist $chan]]] != 0)} {
set count 0
foreach person $users {
if {[lsearch -exact [string tolower $vInviteBotBotnet] [string tolower $person]] != -1} {
incr count
}
}
if {$count > $vInviteBotMaxBots} {
putquick "PRIVMSG $vInviteBotCommandChan :Too many bots already in $chan, parting"
channel remove $chan
} else {putquick "PRIVMSG $vInviteBotCommandChan :JOIN confirmed, $count bot(s) detected"}
} else {
putquick "PRIVMSG $vInviteBotCommandChan :Failed to retrieve channel list for $chan, parting"
if {[validchan $chan]} {
channel remove $chan
}
}
return 0
}
# eof
##################################################################
###### Duplicate bot check procedures for the Eggie botnet #######
########### Code copyright 2009 Josh Johnson "SnoFox" ############
###################### All rights reserved #######################
##################################################################
### Configuration variables; probably duplicated elsewhere >.> ###
global chkchan
# Set the channel where the bots are all halfopped on
set chkchan #Eggs
#######################################
##### Code starts here, obviously #####
#######################################
# On-join check to find duplicates
bind join - *@* sf:dupecheck:join
# On-invite check to see if the channel is temporarily blacklisted (recent failed join)
bind raw - INVITE sf:invite:parse
# Allow temporary blacklists to be broadcast on the botnet
bind bot - sf:temp:blist sf:bot:bl:add
# On join proc
proc sf:dupecheck:join {nick host hand chan} {
# If the channel is in the config file, DON'T CHECK IT
# May be changed to a channel flag; +nocheckdupes
if {![isdynamic $chan]} { return 0 }
# Inititalize variables we'll need
global botnick chkchan
# Am I joining the channel?
if {$botnick == $nick} {
# I have joined the channel
# Loop through all users in the channel to find other bots
foreach x [chanlist $chan] {
if {[ishalfop $x $chkchan]} {
# Bot found! Skip the rest of the loop and part the channel
set botfound $x
continue
}
}
if {[info exists botfound]} {
# We found another bot in the loop; let's get out of here! :P
sf:blacklist:temp $chan {Failed invite}; # Blacklist the channel to prevent join/part spam
putallbots "sf:temp:blist $chan :Failed invite"; # Announce the blacklist to other bots
putquick "PART $chan :Another Eggie bot was found! ($botfound)"
channel remove $chan
return 1
}
# No bots found
return 0
}
}
proc sf:on:invite {nick host hand chan} {
if {[sf:blacklist:chk $chan] == 0} {
channel add $chan +bmotion
} else {
putserv "NOTICE $nick :This channel recently failed at getting a bot. Try again in a few minutes."
}
}
proc sf:invite:parse {mask numeric params} {
# Split everything up into something useable and pass it on
set opts [split $mask "!"]
set nick [lindex $opts 0]
set host [lindex $opts 1]
set opts [split [join $args] ":"]
set chan [join [lindex $opts 1]]
set hand [nick2hand $nick]
set chan $chan
sf:on:invite $nick $host $hand $chan
return 0; # Return 0 so Eggdrop will continue processing the invite
}
###### Blacklist handling ######
# Blacklist checker script.
# @return 0 - if not blacklisted
# @return string - if blacklisted, string holds the reason
proc sf:blacklist:chk {chan} {
# nickname, hostname, and handle are ommited in this script as it's not needed (yet)
global {sf-blist} chkchan
# Is it our access channel? >.>
if {$chan == $chkchan} { return 0 }
# Does the array exist?
if {![array exists {sf-blist}]} {
# Array is non-existant; no channels are blacklisted
return 0
}
# Is the channel blacklisted?
if {[array get {sf-blist} $chan] == ""} {
# No it is not
return 0
}
# It must be blacklisted. Return the reason
return [array get {sf-blist} $chan]
}
proc sf:blacklist:temp {chan reason} {
global {sf-blist}
array set {sf-blist} $chan "$reason"; # Add it to the blacklist array
utimer 60 "sf:blacklist:remove $chan"; # In a minute, unblacklist it
}
proc sf:blacklist:remove {chan} {
global {sf-blist}
array unset {sf-blist} $chan
}
proc sf:bot:bl:add {bot command text} {
sf:blacklist:temp [lindex [split $text] 0] [lrange $text 1 end]
}
# End of File #
I have tested my code above and it works fine. I really don't see what the difference is between 'inviting' a bot and sending/receiving a message instructing it to join a particular channel.
If you wish to write your own, I'll leave you to it. However, I suggest you get a text/script editor that is capable of detecting syntax errors such as Komodo Edit (seperate Tcl Linter needs to be installed). There are glaring syntax errors in your code and those are only the ones that can be detected before it is run.