Downloading File
Filename: AgeBot
menu channel { - Agebot .Echo active rooms: agebot.echrooms .Set rooms: agebot.setup .$iif($istok(%agebot.rooms,$chan,44),Disable,Enable) for this room: agebot.chgrooms $iif($istok(%agebot.rooms,$chan,44),-r,-a) $chan .$iif(%agebot.rooms != $chr(35),Enable for all channels) : agebot.chgrooms -n .$iif(#* iswm %agebot.rooms,Disable for all channels) : agebot.chgrooms -c - } menu status { - Agebot .Echo active rooms: agebot.echrooms .Set rooms: agebot.setup .$iif(%agebot.rooms != $chr(35),Enable for all channels) : agebot.chgrooms -n .$iif(#* iswm %agebot.rooms,Disable for all channels) : agebot.chgrooms -c - } alias -l agebot.proc { if ($3) { if ($3 isnum 18-50) { .notice $2 Thanks for stating your age. :) msg $1 Welcome to $1 $+ , $2 $+ ! :) (Age: $3) mode $1 +v $2 } else { if ($3 < 18) ban -k $1 $2 2 You're too young for this room. (Age: $3 $+ ) else ban -k $1 $2 2 Get out, pedo! (Age: $3 $+ ) .notice $2 Thanks for stating you age, but I can't allow you to be in this room. } } else echo $colour(info) -a * /agebot.proc: Not enough parameters } alias agebot.setup { var %x $input(Please enter channels your bot should ask for age in with commas between (Example: #room1 $+ $chr(44) $+ #room2). $+ $crlf $+ You may notice that 'All channels' is $chr(35) and 'No channels' is 'none',eu,Agebot Setup,%agebot.rooms) if (%x) { var %r /^(?:#[^,]+,?)+$/ if ($regex(%x,%r)) set %agebot.rooms %x else echo $colour(info) -a * /agebot.setup: You must enter rooms in the form of #room, #room1,#room2, $chr(35) or 'none'. } agebot.echrooms } alias -l agebot.chgrooms { if (!$1) || (!$istok(-a,-r,$1,44) && !$2) echo $colour(info) -a * /agebot.chgrooms: Not enough parameters else { var %r /^(?:#[^,]+,?)+$/ if (!$regex(%agebot.rooms,%r)) unset %agebot.rooms if ($1 == -a) %agebot.rooms = $addtok(%agebot.rooms,$2,44) elseif ($1 == -r) { if (%agebot.rooms == $2) %agebot.rooms = none else %agebot.rooms = $remtok(%agebot.rooms,$2,44) } elseif ($1 == -c) %agebot.rooms = none else %agebot.rooms = $chr(35) } agebot.echrooms } alias -l agebot.echrooms { if (%agebot.rooms == $chr(35)) var %x All channels elseif (#* iswm %agebot.rooms) var %x $v2 else var %x No channels echo $colour(info) -a Agebot is currently active in: %x } on !*:JOIN:%agebot.rooms: { if ($readini(agebot.db,np,$chan,$nick)) agebot.proc $chan $nick $v1 else .notice $nick Hey, welcome to $chan $+ , $nick $+ . Just type your age as !agehere in $chan (Example: !17) } on $*:TEXT:/^!(d+)$/S:%agebot.rooms: { if ($readini(agebot.db,np,$chan,$nick)) return var %age $regml(1) agebot.proc $chan $nick %age writeini agebot.db $chan $nick %age } on *:START:if (!%agebot.rooms) agebot.setup on *:UNLOAD:unset %agebot.rooms