Ban script with remove times

By KylePolansky on Jan 07, 2010

Just a little script i made to help making bans. You can ban someone, and set a time for how long they are banned for. When the time is up, the ban will be removed. You can specify your own message, or leave the message part blank, and the kick will have a generic kick message.

How to use: /b | Bans nickname without auto removing the ban. Reason optional. /b | Bans nickname for N seconds and then removes the ban. Reason optional. /b | Same as before, this time with minutes. /b | Same as before, this time with hours.

alias b {
  if $2 == $null {
    /mode $chan +b $address($$1, 2)
    /kick $chan $$1 Banned from $chan
  }
  if ($3 == s) || ($3 == seconds) || ($3 == second) {
    /mode $chan +b $address($$1, 2)
    timer 1 $$2 /mode $chan -b $address($$1, 2)
    if ($4- == $null) {
      /kick $chan $$1 Banned from $chan for $$2 Seconds
    }
    if ($4- != $null) {
      /kick $chan $$1 $4-
    }
  }
  if ($3 == m) || ($3 == minutes) || ($3 == minute) {
    /mode $chan +b $address($$1, 2)
    set %minutes $calc( $$2 * 60)
    timer 1 %minutes /mode $chan -b $address($$1, 2)
    if ($4- == $null) {
      /kick $chan $$1 Banned from $chan for $$2 Minutes
    }
    if ($4- != $null) {
      /kick $chan $$1 $4-
    }
    /unset %minutes
  }
  if ($3 == h) || ($3 == hours) || ($3 == hour) {
    /mode $chan +b $address($$1, 2)
    set %hours $calc( $$2 * 3600)
    timer 1 %hours /mode $chan -b $address($$1, 2)
    if ($4- == $null) {
      /kick $chan $$1 Banned from $chan for $$2 Hours
    }
    if ($4- != $null) {
      /kick $chan $$1 $4-
    }
    /unset %hours
  }
  else {
    /mode $chan +b $address($$1, 2)
    /kick $chan $$1 $2-
  }
}

Comments

Sign in to comment.
Aucun50   -  Jan 09, 2010

I know ;) More fun to think it is.

More
 Respond  
Jethro   -  Jan 08, 2010

Aucun50, this is not a competition. gooshie was pointing out what can be done to have the script made best suited for commanding purposes. We're definitely not trying to complicate codes for the worst, but to demonstrate various ways that can compose a script. Some people may find it useful or even helpful from codes made by others. The end result is more to gain, less to lose for all of us.

More
 Respond  
gooshie   -  Jan 08, 2010

Aucun50 Jethro_ was giving Flux a bot code for !ban I was just ranting about bot codes in general. I could understand having the bot code if it had like user levels or maybe some password recognition type thing to allow you to do op task when you're NOT an op..

More
 Respond  
Aucun50   -  Jan 08, 2010

What's that a gooshie vs Jethro_ script off? I wonder who can make the next script smaller and more impossible to read! We will find out!

More
 Respond  
Jethro   -  Jan 08, 2010

gooshie, your rant is granted, but we're all different in thinking in terms of writing out codes to perform required tasks. Some codes may seem unnecessary or awkward to some people, but to others they may seem like an "easy" button. Aside from the redundancy or iteration of scripting, it explains the reason why MSL is so versatile.

More
 Respond  
gooshie   -  Jan 08, 2010

[rant] I never understood the idea of being an op and then having to message another opped bot to perform a action reserved for an op.. seems like juggling or something.. alot going on and going no where fast.. why end it at one event.. why not message bot and then have bot respond back to you then THAT action perform the actual action... maybe even have the two ops have an automated like discussion back and forth for like 3-4 lines each before the action takes place.. really like where does it end?... whats wrong with a simple popup in the nicklist to perform the action?.. nm.. [/rant]

More
 Respond  
Jethro   -  Jan 07, 2010

Make sure you and the client running the code are opped:

on @*:TEXT:*:#: {
  if ($nick isop #) $iif($$2 ison # && $strip($1) = !ban,$mid($v1,2) -k # $2 2 $3-,.msg # $nick $+ $chr(44) $2 is not found!)
}

this will also work for all the ops only.

More
 Respond  
Flux   -  Jan 07, 2010

i mean, !ban ... ?? :)

More
 Respond  
Flux   -  Jan 07, 2010

can u change it sir?? like !kick ...can we change sir??

More
 Respond  
gooshie   -  Jan 07, 2010
alias kban {
  var %t
  if $regex($3,/^(s|seconds|second|m|minutes|minute|h|hours|hour)$/i) {
    %t = $calc($2 * $replace($left($regml(1),1),s,1,m,60,h,3600))
    ban -ku $+ %t # $1 2 $iif($4,$4-,Banned from # for $replace($duration(%t),sec,$chr(32) second,min,$chr(32) minute,hr,$chr(32) hour))
  }
  else ban -k # $$1 2 $iif($2,$2-,Banned from #)
}
More
 Respond  
sunslayer   -  Jan 07, 2010

id also suggest using the /ban command with the 'k' switch i.e.

ban -k # $nick 2 banned from #
More
 Respond  
Jethro   -  Jan 07, 2010

You can shorten this script quite a bit with regular expressions.

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