#B-Botcode on ;Note that this entire example is very simplistic, there is little to no error checking ;and the script uses a masktype 3 to add users to it's userlist, which in most ;cases is sufficient. Also, there's no flood protection, this is merely ;a very basic "get ops" kinda bot :) ;################### ;#1st, user level management ;################### on 100:TEXT:!addmaster *:#:{ .guser 75 $2 3 } ;Triggers on level 100, which is the owner. Owner can add users of any ;level. Here users are added with mask 3, you can change this at will. ;---- ;Broken down: This event triggers on text typed in the channel. The ;100 ensures that the event will only trigger when an user with level ;100 is typing it, the # means that the event should trigger only when ;the command is typed in the channel, not in private msg. ;guser is a command that adds the given nick to a level, here the level ;to be added to is 75 (master in our example), with masktype 3 ;(which is a typical *!*identd@*.isp.com). !addmaster will be parameter 1 ;($1) in the command given, so the nickname to add will be $2. on 75:TEXT:!delmaster *:#:{ ;as above, but here the event will trigger for masters as well as owners ;(masters are level 75). IF ($2) && ($level($address($nick,3)) >= 100) { .ruser 75 $2 3 } ;if a nick is specified, the owner (level 100) may remove a master ;---- ;Broken down: IF ($2) checks if there is another parameter in the command, ;if there is, and the level of the user giving the command is 100 (owner) ;or more, then proceed with removing the user specified ;(ruser removes an user from the userlevel specified). ELSEIF ($level($address($nick,3)) == 75) { .ruser 75 $nick 3 } ;if no nick specified, a master (level 75) may remove himself. ;---- ;Broken down: This triggers if the if ($2) doesn't, and the level of the ;user using the command is 75 (master). It will proceed to removing the ;person typing the command from userlevel master. } on 75:TEXT:!addop *:#:{ .guser 50 $2 3 } on 50:TEXT:!delop *:#:{ IF ($2) && ($level($address($nick,3)) >= 75) { .ruser 50 $2 3 } ELSEIF ($level($address($nick,3)) == 50) { .ruser 50 $nick 3 } ;these lines are similar to the add/delmaster lines. } on 50:TEXT:!addvoice *:#:{ .guser 25 $2 3 } on 25:TEXT:!delvoice *:#:{ IF ($2) && ($level($address($nick,3)) >= 50) { .ruser 25 $2 3 } ELSEIF ($level($address($nick,3)) == 25) { .ruser 25 $nick 3 } } on 25:TEXT:!level *:#:{ IF ($2) { msg $chan $2 $+ 's level is $level($address($2,3)) } ;if a nick is specified, it's userlevel will be msg'd to the channel ;---- ;Broken down: If an additional parameter was given in the command, then ;tell the channel what userlevel this user specified in $2 (parameter two) ;had. $+ is a special identifier enabling you to pull two characters or words ;together, typically used where you want other characters next to an identifier, ;which is otherwise an impossibility (next to always). ELSE { msg $chan Your level is $level($address($nick,3)) } ;if no nick specified, the user's level is msg'ed to the channel. } ;################# ;#2nd, automatic op/voice ;################# on @25:JOIN:#:{ ;this event will op owner/master/op on join to the channel, ;and voice a voice level user when he joins IF ($level($address($nick,3)) >= 50) { mode # +o $nick } ELSEIF ($level($address($nick,3)) < 50) { mode # +v $nick } } ;################## ;#3rd, op/voice on demand ;################## on @50:TEXT:!op *:#:{ ;Ops a given user if specified by a master or owner, otherwise it'll ;op the user using the command IF ($level($address($nick,3)) >= 75) { IF ($2) { mode # +o $2 } ELSE { mode # +o $nick } ELSEIF ($level($address($nick,3)) < 75) { mode # +o $nick } } on @25:TEXT:!voice *:#:{ ;Voices a given user specified by an op or above, or voices the nick ;using the command otherwise IF ($level($address($nick,3)) >= 50) { IF ($2) { mode # +v $2 } ELSE { mode # +v $nick } ELSEIF ($level($address($nick,3)) < 50) { mode # +v $nick } } on @*:TEXT:!devoice *:#:{ ;devoices any user if specified by an op or above, otherwise it'll ;devoice whoever is using the command. Note that even users not added ;to the bot can use this command to devoice themselves. IF ($level($address($nick,3)) >= 50) { IF ($2) { mode # -v $2 } ELSE { mode # -v $nick } ELSE { mode # -v $nick } } ;############## ;#4th, Kicks and bans ;############## on @50:TEXT:!kick *:#:{ kick # $2 $3- } ;kicks the nick specified with a given message, when command ;is given by an op or above. The message will be ;all text written after the nick of the user to kick on @75:TEXT:!kb *:#:{ ban -u30 # $2 3 | kick # $2 $3- } ;as above, but will also ban the user for 30 seconds using ;masktype 3. ;################## ;#5th join/part/quit system ;################## on 75:TEXT:!join *:*:{ join #$2 } ;a master (level 75) user can make the bot join another channel on 75:TEXT:!part *:*:{ ;a master can also make the bot leave a channel specified IF ($2 ischan) { part #$2 } ;if the channel specified is an actual channel the bot is on, leave it ELSEIF ($active ischan) { part $active } ;if no channel specified, but active window is a channel, leave it. } on 100:TEXT:!quit:*:{ quit Bot shut down ordered by $nick ( $+ $1- $+ ) } ;owner can make the bot quit ;############ ;#6th, Help system ;############ on *:JOIN:#:{ ;sends a simple message to people joining the channel, when they are not ;added to the bot (this to prevent regular users of the channel from the ;annoyance of being told this over and over again :) IF ($level($address($nick,3)) < 25) { .notice $nick Welcome to $chan $+ , $nick $+ ! I am this channel's bot, ;$chan will be replaced by the channel joined. .notice $nick and you may request help on a specific topic by sending .notice $nick me a message like /msg $me help [topic]. ;$me will be replaced with the bot's nick. It's merely there for convenience .notice $nick Topic is optional, help alone will send you a list .notice $nick of available help topics. Thank you and have a nice day :) } } on *:TEXT:help *:*:{ IF ($2 == voice) { ;the requested help was on the voice command, ;so we send the user the appropriate help. .notice $nick Help on voice .notice $nick Syntax: !voice [nick] .notice $nick Available to level 25 users and above, .notice $nick nick is optional. ELSEIF ($2 == op) { .notice $nick etc } ELSE { ;General help telling the user which commands are available on the bot ;this triggers if none of the above sections triggers (in other words, ;when an unspecified word is used for parameter two). .notice $nick Help system for $me $+ : .notice $nick Available commands: .notice $nick !op [nick] | !voice [nick] .notice $nick etc.. } } #B-Botcode end