Admin System (v1)

By KryptonCnR on Nov 29, 2013

I used the base of "Friends List" which "napa182" did. (http://www.hawkee.com/snippet/3129/)

I thought I could extend this a bit to allow (owners, sysop, ops, halfops, voice) to be added by the use of a command instead of having the IRC Network Bots doing it all the time, whereas the BOT can do it as long as they are ~ in the room.

If the bot is & then just remove the Owner parts, if your bot is @ then remove the Owner / SysOp parts and so on! unless you are going to make your BOT a owner which you could add yourself to it and add yourself a long with anyone else who is owner of the room

just type, /master to become the bot master (as it'll only listen to you and no one else).

It will automatically create a .txt file for owner, sysop, op, halfop, voice when you put users in them and if you have more than 1 in that category and go to do !listvoice (for example), it will list all the users in that group.

Hope you like it,

KryptonCnR

alias master { set %master $1 | echo -a 10Bot Owner Is Now 4"10 $+ $1 $+ 4" }
on *:text:!adminhelp:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    notice %master 10The System Commands Are:
    notice %master 10To Add A Owner, 4!addowner <nick> 
    notice %master 10To Add A System Op, 4!addsysop <nick>
    notice %master 10To Add A Op, 4!addop <nick>
    notice %master 10To Add A Half-Op, 4!addhalfop <nick>
    notice %master 10To Add A Voice, 4!addvoice <nick>
    notice %master 10To Delete A Owner, 4!delowner <nick>
    notice %master 10To Delete A System Op, 4!delsysop <nick>
    notice %master 10To Delete A Op, 4!delop <nick>
    notice %master 10To Delete A Half-Op, 4!delhalfop <nick>
    notice %master 10To Delete A Voice, 4!delvoice <nick>
    notice %master 10To Find A 4"10User4" 10In A Grouplist Type Either8: 4!10listowner 8- 4!10listsysop 8- 4!10listop 8- 4!10listhalfop 8- 4!10listvoice
  }
}
on *:text:!listowner:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    if $read(owner.txt) == $null {
      msg $chan 10Your Owner List Is Empty.
    }
    elseif $read(owner.txt) != $null {
      var %x = 1
      while (%x <= $lines(owner.txt)) {
        if (%x = 1) {
          set %listowner $read(owner.txt,%x)
          inc %x
        }
        else {
          set %listowner %listowner $+ , $read(owner.txt,%x)
          inc %x
        }
      }
    }
    msg $chan 10Owner List4:10 %listowner
    unset %listowner
  }
}
on *:text:!listsysop:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    if $read(sysop.txt) == $null {
      msg $chan 10Your Sys Op List Is Empty.
    }
    elseif $read(sysop.txt) != $null {
      var %x = 1
      while (%x <= $lines(sysop.txt)) {
        if (%x = 1) {
          set %listsysop $read(sysop.txt,%x)
          inc %x
        }
        else {
          set %listsysop %listsysop $+ , $read(sysop.txt,%x)
          inc %x
        }
      }
    }
    msg $chan 10Sys Op List4:10 %listsysop
    unset %listsysop
  }
}
on *:text:!listop:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    if $read(op.txt) == $null {
      msg $chan 10Your Op List Is Empty.
    }
    elseif $read(op.txt) != $null {
      var %x = 1
      while (%x <= $lines(op.txt)) {
        if (%x = 1) {
          set %listop $read(op.txt,%x)
          inc %x
        }
        else {
          set %listop %listop $+ , $read(op.txt,%x)
          inc %x
        }
      }
    }
    msg $chan 10Op List4:10 %listop
    unset %listop
  }
}
on *:text:!listhalfop:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    if $read(halfop.txt) == $null {
      msg $chan 10Your Half Op List Is Empty.
    }
    elseif $read(halfop.txt) != $null {
      var %x = 1
      while (%x <= $lines(halfop.txt)) {
        if (%x = 1) {
          set %listhalfop $read(halfop.txt,%x)
          inc %x
        }
        else {
          set %listhalfop %listhalfop $+ , $read(halfop.txt,%x)
          inc %x
        }
      }
    }
    msg $chan 10Half Op List4:10 %listhalfop
    unset %listhalfop
  }
}
on *:text:!listvoice:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    if $read(voice.txt) == $null {
      msg $chan 10Your Voice List Is Empty.
    }
    elseif $read(voice.txt) != $null {
      var %x = 1
      while (%x <= $lines(voice.txt)) {
        if (%x = 1) {
          set %listvoice $read(voice.txt,%x)
          inc %x
        }
        else {
          set %listvoice %listvoice $+ , $read(voice.txt,%x)
          inc %x
        }
      }
    }
    msg $chan 10Voice List4:10 %listvoice
    unset %listvoice
  }
}
on *:text:!addowner *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %addowner $readowner.txt,w,$$2)
    if (%addowner == $$2) {
      msg $chan 10Owner: 4 $$2 10already exists!
      unset %addowner
    }
    else {
      write owner.txt $$2
      msg $chan 4 $$2 10Added To Owner List.
      unset %addowner
    }
  }
}
on *:text:!addsysop *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %addsysop $read(sysop.txt,w,$$2)
    if (%addsysop == $$2) {
      msg $chan 10Sys Op: 4 $$2 10already exists!
      unset %addsysop
    }
    else {
      write sysop.txt $$2
      msg $chan 4 $$2 10Added To Sys OP List.
      unset %addsysop
    }
  }
}
on *:text:!addop *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %addop $read(op.txt,w,$$2)
    if (%addop == $$2) {
      msg $chan 10Op: 4 $$2 10already exists!
      unset %addop
    }
    else {
      write op.txt $$2
      msg $chan 4 $$2 10Added To Admin List.
      unset %addop
    }
  }
}
on *:text:!addhalfop *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %addhalfop $read(halfop.txt,w,$$2)
    if (%addhalfop == $$2) {
      msg $chan 10Half Op: 4 $$2 10already exists!
      unset %addhalfop
    }
    else {
      write halfop.txt $$2
      msg $chan 4 $$2 10Added To Half Op List.
      unset %addhalfop
    }
  }
}
on *:text:!addvoice *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %addvoice $read(voice.txt,w,$$2)
    if (%addvoice == $$2) {
      msg $chan 10Voice: 4 $$2 10already exists!
      unset %addvoice
    }
    else {
      write voice.txt $$2
      msg $chan 4 $$2 10Added To Voice List.
      unset %addvoice
    }
  }
}
on *:text:!delowner *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %delowner $read(owner.txt,w,$$2)
    if (%delowner == $$2) {
      write  -dl [ $+ [ $readn ] ] owner.txt
      msg $chan 10Owner: 4 $$2 10deleted!
      unset %delowner
    }
    else {
      msg $chan 10Owner: 4 $$2 10doesn't exist!
      unset %delowner
    }
  }
}
on *:text:!delsysop *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %delsysop $read(sysop.txt,w,$$2)
    if (%delsysop == $$2) {
      write  -dl [ $+ [ $readn ] ] sysop.txt
      msg $chan 10SysOp: 4 $$2 10deleted!
      unset %delsysop
    }
    else {
      msg $chan 10SysOp: 4 $$2 10doesn't exist!
      unset %delsysop
    }
  }
}
on *:text:!delop *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %delop $read(op.txt,w,$$2)
    if (%delop == $$2) {
      write  -dl [ $+ [ $readn ] ] op.txt
      msg $chan 10Op: 4 $$2 10deleted!
      unset %delop
    }
    else {
      msg $chan 10Op: 4 $$2 10doesn't exist!
      unset %delop
    }
  }
}
on *:text:!delhalfop *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %delhalfop $read(halfop.txt,w,$$2)
    if (%delhalfop == $$2) {
      write  -dl [ $+ [ $readn ] ] halfop.txt
      msg $chan 10Half Op: 4 $$2 10deleted!
      unset %delhalfop
    }
    else {
      msg $chan 10Half Op: 4 $$2 10doesn't exist!
      unset %delhalfop
    }
  }
}
on *:text:!delvoice *:#: {
  if ($nick != %master) {
    msg $chan 10Sorry 4"10 $+ $nick $+ 4" 10But You Are Not My 4"10Owner4"10.
  }
  elseif ($nick == %master) {
    set %delvoice $read(voice.txt,w,$$2)
    if (%delvoice == $$2) {
      write  -dl [ $+ [ $readn ] ] voice.txt
      msg $chan 10Voice: 4 $$2 10deleted!
      unset %delvoice
    }
    else {
      msg $chan 10Voice: 4 $$2 10doesn't exist!
      unset %delvoice
    }
  }
}
on *:join:#: {
  if ($nick isin $read(owner.txt, w, $nick)) {
    notice $nick 10Greetings 4" $+ $nick $+ 4" 10Since You Are Apart Of The 4"10Owner Group4" 10You Have Been Made 4"10Owner4"10.
    mode $chan +q $nick
  }
  elseif ($nick isin $read(sysop.txt, w, $nick)) {
    notice $nick 10Greetings 4" $+ $nick $+ 4" 10Since You Are Apart Of The 4"10System Op Group4" 10You Have Been Made 4"10Co-Owner4"10.
    mode $chan +ao $nick
  }
  elseif ($nick isin $read(op.txt, w, $nick)) {
    notice $nick 10Greetings 4" $+ $nick $+ 4" 10Since You Are Apart Of The 4"10Op Group4" 10You Have Been Made 4"10Op4"10.
    mode $chan +o $nick
  }
  elseif ($nick isin $read(halfop.txt, w, $nick)) {
    notice $nick 10Greetings 4" $+ $nick $+ 4" 10Since You Are Apart Of The 4"10Half Op Group4" 10You Have Been Made 4"10Half Op4"10.
    mode $chan +h $nick
  }
  elseif ($nick isin $read(voice.txt, w, $nick)) {
    notice $nick 10Greetings 4" $+ $nick $+ 4" 10Since You Are Apart Of The 4"10Voice Group4" 10You Have Been Made 4"10Voice4"10.
    mode $chan +v $nick
  }
}

Comments

Sign in to comment.
ProIcons   -  Dec 10, 2013

Well you don't really need all these on text events. You can merge all of your code into one on text event. Also you can play with the built-in user levels of your mIRC. For example you can make the Bot owner, level 4, head admin level 3, admin level 2. and check it with $ulevel. U can also instead of setting global variables, and unseting them, to create local variables with command "var" instead of "set', also instead of using plain text file, you can even make an INI file, or even a hash table... in this way you can merge all of your "files" into one, and save much proccessing time.

 Respond  
H0LLYWOOD   -  Dec 05, 2013

looks good.
does this work for mutliple networks and channels?
does it look by name. or by user@host?
thats one thing im looking for in a access script.
good job so far. im looking forward to seeing this progress.

KryptonCnR  -  Dec 08, 2013

It's currently set to name at the moment, but I am going to update it to @vhost or @host as anyone could use this script in any room but if you give a user !addop in one room, it will automatically op them in any other room the bot is in (so make sure if you want to add them to a certain rank then set it to one, will work on adding multiple channels in future one)

Sign in to comment

Tekmbster   -  Dec 03, 2013

Kudos to your take on the Friend's list and making it into an awesome Admin Script!

ProIcons  -  Dec 10, 2013

you mean user list, right?

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.