Just one of those "old bot projects no longer in use but still had script" type of thing, so decided to post my old random bot joiner, made with help (at the time of being made) by my old friend nathan on the $gettok
just replace the bot (being main/hub) bot1 bot2 with the bot nicks and the $staffchan with your chan in the #staffchan portion
Note that it doesnt pick bot with lowest chans/most or anything just randomly so can edit to make it do different but on a low scale bot project, this usually does the job, Also the $r(1,3) is for 3 bots so can change the 3 to a 2 if only 2 bots
;Staffchannel
alias staffchan return #staffchannel
;Invite portion
on *:invite:#: {
.ignore -u3i $nick
if ($me == bot) {
var %x $gettok(bot bot1 bot2,$rand(1,3),32)
msg %x Join # $nick
msg $staffchan Sent %x To join # - $nick invited.
}
else notice $nick Please invited bot
}
;Join portion that does the on join message, Add in your own message otherwise itll say whats written
on *:TEXT:Join*:?: {
if ($nick == bot) {
join $2
msg $2 I was invited by $3 - I am $me - Bot Stuff HERE
}
}
Your join event is questionable. The $3 shouldn't be the nick who invites the client that runs the code. It should have been $v1 or $nick, meaning the "bot." Your script will only respond to the nickname bot and no one else. My approach will be this:
on $*:TEXT:/( |^)(join \x23(?!\x23)(\S+))/iS:?: {
if ($nick == BotNick) {
$regml(2)
msg $gettok($regml(2),2,32) I was invited by $v1 - I am $me - $iif($3,$3-,Default Message Here)
}
}
This will ensure that it is a channel name starting with a single # prefix and not something else. You can then use an $iif() to ouput the message, which is $3-; if not provided, it returns Default Message here.