Staffbot
Posted by Rustynails
Friday, April 02, 2004
Description: Staffbot...What else can i say?


alias admin {
  if ($1 == $null) {
    echo -a || Must have a person's nickname entered!
  }
  elseif ($left($active,1) != $chr(35)) {
    echo -a || The active window must be a channel!
  }
  elseif ($1 !ison $active) {
    echo -a || $2 must be on $active $+ !
  }
  else {
    set %main $address($1,1)
    echo -a || New admin is $1 $+ ! Hostmask: $address($1,1)
  }
}
on *:TEXT:[unsuspend] *:#:{
  if (%staff == on) {
    if ($2 ison $chan) {
      if ($read(suspended.txt,w,$address($2,1))) {
        msg $chan [^B][[^B]Congrats[^B]][^B] $2 $+ 's account has been [^B]un[^B]-suspended!
        .write -dw " $+ $address($2,1) $+ " suspended.txt
      }
      else {
        msg $chan [^B][[^B]Sorry[^B]][^B] $2 $+ 's account is not suspended!
      }
    }
    else {
      msg $chan [^B][[^B]Sorry[^B]][^B] $2 is not on this channel!
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline!
  }
}
on *:TEXT:[suspend] *:#service:{
  if (%staff == on) {
    if ($address($nick,1) == %main) {
      if ($2 ison $chan) {
        if (!$read(suspended.txt,w,$address($2,1))) {
          if ($read(registered.txt,w,$address($2,1))) {
            if ($read(admins.txt,w,$2)) {
              msg $chan [^B][[^B]Congrats[^B]][^B] $2 has been logged out. [^B]([^B]Suspended[^B])[^B]
              .write -dw " $+ $2 $+ " admins.txt
              .write -dw " $+ $address($2,1) $+ " registered.txt
              .write suspended.txt $address($2,1)
            }
            else {
              msg $chan [^B] $+ $2 $+ [^B]'s account has been suspended.
              .write -dw " $+ $address($2,1) $+ " registered.txt
              .write suspended.txt $address($2,1)
            }
          }
          else {
            msg $chan [^B][[^B]Congrats[^B]][^B] $2 $+ 's hostmask has been added to the suspension list.
            .write suspended.txt $address($2,1)
          }
        }
        else {
          msg $chan [^B][[^B]Sorry[^B]][^B] $2 $+ 's account is already suspended.
        }
      }
      else {
        msg $chan [^B][[^B]Sorry[^B]][^B] $2 is not on this channel!
      }
    }
    else {
      msg $chan [^B][[^B]Sorry[^B]][^B] You do not have access to this command!
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline!
  }
}
on *:TEXT:[unreg.acct] *:#service:{
  if ($address($nick,1) == %main) {
    if ($2 ison $chan) {
      if ($read(registered.txt,w,$address($2,1))) {
        if ($read(admins.txt,w,$address($2,1))) {
          msg $chan [^B] $+ $2 [^B]has been logged out. [^B]([^B]Account Deleted![^B])[^B]
          .write -dw " $+ $2 $+ " admins.txt
          .write -dw " $+ $address($2,1) $+ " registered.txt
        }
        else {
          msg $chan [^B] $+ $2 $+ [^B]'s account has been deleted.
          .write -dw " $+ $address($2,1) $+ " registered.txt
        }
      }
      else {
        msg $chan [^B][[^B]Sorry[^B]][^B] $2 does not have an account registered for his/her hostmask!
      }
    }
    else {
      msg $chan [^B][[^B]Sorry[^B]][^B] $2 is not on this channel!
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] You have insufficient access.
  }
}
on *:TEXT:[register]:#service:{
  if (%staff == on) {
    if ($nick isop $chan) {
      if (!$read(suspended.txt,w,$address($nick,1))) {
        if ($read(registered.txt,w,$address($nick,1))) {
          msg $chan [^B][[^B]Sorry[^B]][^B] Your hostmask is already registered!
        }
        else {
          msg $chan [^B][[^B]Congrats[^B]][^B] Your hostmask has been added! You may now login!
          write registered.txt $address($nick,1)
        }
      }
      else {
        msg $chan [^B][[^B]Sorry[^B]][^B] Your account is currently suspended!
      }
    }
    else {
      msg $chan [^B][[^B]Sorry[^B]][^B] You are not opped!
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}
on *:TEXT:[login]:#service:{
  if (%staff == on) {
    if ($read(registered.txt,w,$address($nick,1))) {
      if ($read(admins.txt,w,$nick)) {
        .notice $nick [^B][[^B]Sorry[^B]][^B] you're already logged in.
      }
      elseif ($nick isop $chan) {
        .write admins.txt $nick
        .notice $nick [^B][[^B]Congrats[^B]][^B] You are now logged in.
        msg $chan [^B] $+ $nick [^B]has just logged in.
      }
      else {
        msg $chan [^B][[^B]Sorry[^B]][^B] You're not opped in this channel.
      }
    }
    else {
      msg $chan [^B][[^B]Sorry[^B]][^B] You do not have your hostmask registered.
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}
on *:TEXT:[logout]:#service:{
  if (%staff == on) {
    if ($read(admins.txt,w,$nick)) {
      .notice $nick [^B][[^B]Congrats[^B]][^B] You logged out successfully.
      msg $chan [^B] $+ $nick [^B]has just logged out.
      .write -dw " $+ $nick $+ " admins.txt
    }
    else {
      .notice $nick [^B][[^B]Sorry[^B]][^B] You are not logged in.
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}

on *:PART:#service:{
  if ($read(admins.txt,w,$nick)) {
    .write -dw " $+ $nick $+ " admins.txt
    msg $chan [^B] $+ $nick [^B]has just been logged out. [^B]([^B]Parted[^B])[^B]
  }
}
on *:TEXT:[staff]:#service:{
  if (%staff == on) {
    set %lines $lines(admins.txt)
    if (%lines == 0) {
      msg $chan [^B][[^B]Sorry[^B]][^B] There is currently no staff logged in.
    }
    else {
      set %nick $chan
      msg $chan [^B]Staff[^B]:
      /staff
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}
alias staff {
  var %r 1
  while (%r <= $lines(admins.txt)) {
    var %u = %u $+ $iif(%r != 1,$chr(44)) $read(admins.txt,%r)
    inc %r
  }
  msg %nick %u
  .unset %nick
}

on *:TEXT:[staff.msg] *:#service:{
  if (%staff == on) {
    if ($lines(admins.txt) == 0) {
      .notice $nick [^B][[^B]Sorry[^B]][^B] There is no logged [^B]in[^B] staff.
      msg $chan [^B][[^B]Sorry[^B]][^B] There is no logged [^B]in[^B] staff.
    }
    else {
      notice $nick Message sent to [^B]all[^B] logged [^B]in[^B] staff.
      .set %msg [^B][[^B] $+ $time(hh:nn:sstt) $+ [^B]][^B] [^B][[^B] $+ $nick $+ [^B]][^B] [^U]Message[^U]: $2-
      /msgstaff
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}
alias msgstaff {
  var %r 1
  while (%r <= $lines(admins.txt)) {
    .notice $read(admins.txt,%r) %msg
    inc %r
  }
  .unset %msg
}
on *:QUIT:{
  if ($read(admins.txt,w,$nick)) {
    .write -dw " $+ $nick $+ " admins.txt
    msg $chan [^B] $+ $nick [^B]has just been logged out. [^B]([^B]Quit[^B])[^B]
  }
}
on *:TEXT:[logout.force] *:#service:{
  if (%staff == on) {
    if ($address($nick,1) == %main) {
      if ($read(admins.txt,w,$2)) {
        .notice $2 You have been logged [^B]out[^B] by[^B] $nick $+ [^B].
        msg $chan [^B] $+ $2 [^B]has been logged [^B]out[^B].
        .write -dw " $+ $2 $+ " admins.txt
      }
      else {
        msg $chan [^B] $+ $2 [^B]is not logged [^B]in[^B].
      }
    }
    else {
      .notice $nick You do not have the [^B]access[^B] to this.
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}
on *:TEXT:[login.force] *:#service:{
  if (%staff == on) {
    if ($2 ison $chan) {
      if ($address($nick,1) == %main) {
        if ($read(admins.txt,w,$2)) {
          .notice $nick [^B][[^B]Sorry[^B]][^B] $2 is already logged in.
        }
        else {
          .notice $nick [^B][[^B]Congrats[^B]][^B] $2 has been logged in.
          .write admins.txt $2
          msg $chan [^B] $+ $2 [^B]has just been logged in [^B]([^B]Force[^B])[^B].
        }
      }
      else {
        .notice $nick You do not have the [^B]access[^B] to this.
      }
    }
    else {
      .notice $nick [^B] $+ $2 [^B]is not on this channel.
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}
on *:TEXT:[logout.all]:#service:{
  if (%staff == on) {
    if ($address($nick,1) == %main) {
      if ($lines(admins.txt) == 0) {
        notice $nick You cannot logout this chan, because there are [^B]0[^B] staff who are logged [^B]in[^B].
      }
      else {
        .remove admins.txt
        .notice $nick The whole channel has been logged [^B]out[^B].
        msg $chan The whole channel has been logged [^B]out[^B]. Please log back [^B]in[^B].
      }
    }
    else {
      .notice $nick You do not have [^B]access[^B] to this command.
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}
on *:TEXT:[login.all]:#service:{
  if (%staff == on) {
    if ($address($nick,1) == %main) {
      if ($nick(#service,0,o) == 0) {
        .notice $nick There is nobody to [^B]login[^B].
      }
      else {
        .remove admins.txt
        set %nick $nick
        set %chan $chan
        /loginall
      }
    }
    else {
      .notice $nick You do not have [^B]access[^B] to this command.
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is currently offline.
  }
}
alias loginall {
  var %r 1
  while (%r <= $nick(%chan,0,o)) {
    .write admins.txt $nick(%chan,%r,o)
    inc %r
  }
  msg %chan All [^B]ops[^B] have been logged [^B]in[^B]. [^B]([^B]Force[^B])[^B]
  .notice %nick All [^B]ops[^B] have been logged [^B]in[^B]. [^B]([^B]Force[^B])[^B]
  unset %chan
  unset %nick
}

on *:NICK:{
  .set %nick $nick
  .set %newnick $newnick
  if ($read(admins.txt,w,%nick)) {
    write -dw " $+ %nick $+ " admins.txt
    write admins.txt %newnick
    .unset %nick
    .unset %newnick
  }
  else {
    .unset %nick
    .unset %newnick
  }
}
on *:DEOP:#service:{
  if ($address($opnick,1) == %main) {
    set %staff off
    msg $chan [^B][[^B]Sorry[^B]][^B] You have deopped $nick $+ . The Staff Service is now off.
  }
  elseif ($read(admins.txt,w,$opnick)) {
    msg $chan [^B] $+ $opnick $+ [^B] has been logged out. [^B]([^B]Deopped[^B])[^B]
    write -dw " $+ $opnick $+ " admins.txt
  }
}
on *:TEXT:[service.on]:#service:{
  if ($address($nick,1) == %main) {
    if (%staff == on) {
      msg $chan [^B][[^B]Sorry[^B]][^B] The Staff Service is already online!
    }
    else {
      msg $chan [^B][[^B]Congrats[^B]][^B] The Staff Service is now online!
      .set %staff on
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] You have insufficient access.
  }
}
on *:TEXT:[service.off]:#service:{
  if ($address($nick,1) == %main) {
    if (%staff == on) {
      msg $chan [^B][[^B]Congrats[^B]][^B] The Staff Service is now offline.
      .set %staff off
      .remove admins.txt
    }
    else {
      msg $chan [^B][[^B]Congrats[^B]][^B] The Staff Service is already offline.
    }
  }
  else {
    msg $chan [^B][[^B]Sorry[^B]][^B] You have insufficient access.
  }
}
on *:TEXT:[service.info]:#service:{
  $iif(%staff == on,/msg $chan The [^B]Staff Service[^B] is currently online.,/msg $chan The [^B]Staff Service[^B] is currently offline.)
}

Subject line
Posted by snang
Friday, April 02, 2004 03:15pm PST
Comment
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world