Menu/Alias Blacklist with Password Auth

By DragonFlare on Sep 29, 2017

A friend wanted me to make him a menu blacklist with password authentication.

I also added my bot version that i posted some time ago i updated that one to check for operator status.

The password feature is a good add on especially if you have little ones so no one gets blacklisted by mistake

Hope you enjoy it :D

On *:load:{
  write password.txt $$?="Please select a password."
  write Blacklist.txt
}
####################################
#                                  #
# Blacklist Section                #
#                                  #
####################################
On *:Text:*:#:{
  var %Blacklist write Blacklist.txt $address($2,1)
  var %Delete write -dl [ $+ [ $address($2,1) ] ] Blacklist.txt
  var %Check $read(Blacklist.txt)
  tokenize 32 $strip($1-)
  if ($1 == Blacklist && $nick isop $chan) { %Blacklist | msg $chan $2 Added to my Blacklist files. | mode $chan +b $address($2,1) | kick $chan $2 Reason: $3- Blacklisted! }
  elseif ($1 == Delete && $nick isop $chan) { if (%Check = $null) { msg $chan $2- Isn't blacklisted $nick $+ . }
    else { %Delete | msg $chan $2 deleted from my Blacklist files $nick $+ . }
  }
  elseif ($1 == Check) { if (%Check = $null) { msg $chan $2 isn't Blacklisted $nick $+ . }
    else { msg $chan $2 is Blacklisted under the address %Check $+ . }
  }
}

Menu Channel,Nicklist {
  -
  Blacklist
  .Blacklist
  ..Add {
    var %Blacklist write Blacklist.txt $address($1,1)
    if ($$?!="Are you sure you want to Blacklist $1 $+ ?" = $true && $$?*="Action requires authentication" = $read(password.txt)) {
      %Blacklist
      msg $chan $1 Added to Blacklist
      mode $chan +b $address($1,1)
      kick $chan $1 Reason: $$?="Reason for blacklist?!" $+ !
    }
  }
  ..Check {
    set %user $address($$?="User to check against blacklist?",1)
    if ($$?*="Authentication required" = $read(password.txt) && $read(Blacklist.txt) = %user) {
      echo -a User is blacklisted under %user
    }
    else echo -a User not found.
    unset %user
  }
  ..Delete {
    set %User $address($$?="User?",1)
    var %Check $read(Blacklist.txt)
    var %Delete write -dl [ $+ [ $address(%User,1) ] ] Blacklist.txt
    if ($$?*="Authentiation Required" = $read(password.txt) && %User = %check) {
      %delete
      echo -a User Removed
      unset %User
    }
  }
}
############################################
#                                          #
# On Join Section                          #
#                                          #
############################################
On *:Join:#:{
  if ($read(Blacklist.txt) == $address($nick,1)) { 
    msg $chan You're currently blacklisted $nick
    mode $chan +b $address($nick,1)
    kick $chan $nick Reason: Blacklisted
  }
}
############################################
#                                          #
# Alias Section                            #
#                                          #
############################################

Alias Blacklist {
  var %Delete write -dl [ $+ [ $address($2,1) ] ] Blacklist.txt
  var %Blacklist write Blacklist.txt $address($2,1)
  if ($1 == delete && $$?="Action requires authentication" = $read(password.txt)) { %Delete | echo -a Removed }
  elseif ($1 == add && $$?="Action requires authentication" = $read(password.txt)) { %Blacklist | echo -a User Added }
  elseif ($1 == check && $read(Blacklist.txt) = $address($2,1)) { echo -a User is in file. } 
}

Comments

Sign in to comment.
DragonFlare   -  23 days ago

Also I am currently working on updating it with more features as well as re-coding the structure but that is a working version with no bugs I tested it constantly as I was coding it so it is still a solid piece of code. And I know storing the password in a .txt is not advised so I am working on that as well but again the password feature works and is solid most people who aren't MSL Scripters wouldn't know where to look for a password file anyways. But yes I am working on updating it and I am open to suggestions. So as it stands the script functions and does what it is intended to do.

 Respond  
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.