Multiple network problem for bot - 12/12/05 04:53 AM
Part of my script for my bot allows it to be on multiple networks, with certain people having the authority to add new networks &/or channels for the bot to run in.
The problem that I've encountered is that some networks use a nick registration service.
If the bot connects to a network that it isn't configured for (ie: nickname & password stored in the hash table for that network), I want a dialog to come up on my screen showing the name of the person that added the network, the network name, and (if applicable) any channels that the bot was supposed to join.
It would be great if the registration information could be sent automatically, but I know that some nick registration services require a confirmation e-mail to be responded to, and I'm not sure if my bot could be configured to do that (although if it is possible, that might be something I could incorporate)
The !add network & !add room codes are below.
(If anyone has any suggestions as to how these could be done better, I'm listening)
The problem that I've encountered is that some networks use a nick registration service.
If the bot connects to a network that it isn't configured for (ie: nickname & password stored in the hash table for that network), I want a dialog to come up on my screen showing the name of the person that added the network, the network name, and (if applicable) any channels that the bot was supposed to join.
It would be great if the registration information could be sent automatically, but I know that some nick registration services require a confirmation e-mail to be responded to, and I'm not sure if my bot could be configured to do that (although if it is possible, that might be something I could incorporate)
The !add network & !add room codes are below.
(If anyone has any suggestions as to how these could be done better, I'm listening)
Code:
on op:text:!add network*:*:{ if !$3 { var %server = $hfind(Networks,$server,0).data if !%server { .hinc -m Networks $network .hadd -m Networks $+($network,.,$hget(Networks,$network)) $server } } elseif !$4 { .msg $nick Usage !add network <network> <server> } else { var %server = $hfind(Networks,$4,0).data if !%server { .hinc -m Networks $3 .hadd -m Networks $+($3,.,$hget(Networks,$3)) $4 .msg $nick Network $3 with server address $4 has been added var %i scon -at1 if ($network == $3) inc % $+ i if (!%i) server -mfc $4 } } } on op:text:!add room*:*:{ if ($target != $chan) && !$3 { .msg $nick Usage: !add room (network) <channel> .msg $nick (network) is optional } elseif !$3 { .hadd -m $network $chan } else { .hadd -m $iif(!$4,$network,$3) $iif(!$4,$3,$4) if $4 && ($3 != $network) { var %network = $hfind(Networks,$+($3,.*),0,w) if !%network { .msg $nick Sorry, but I can't find $3 in my list of networks .msg $nick Use !add network <network> <server> to add it } else { var %c = 1 while $scon(%c).network { if ($v1 == $iif(!$4,$network,$3)) { if ($me !ison $iif(!$4,$3,$4)) { .join $iif(!$4,$3,$4) inc %joined } } inc %c } if !%joined { var %i scon -at1 if ($network == $3) inc %i if (!%i) server -mfc $3 } } } } }