Advertisement
outsider

kickban for eggdrop - kick first

Oct 9th, 2018
713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.79 KB | None | 0 0
  1. bind dcc - kb dcc:kb
  2. proc dcc:kb {from idx args} {
  3.     global lastbind ban-time
  4.    
  5.     set valid 1
  6.     set isnick 0
  7.     set counter 1
  8.    
  9.     #check for nick or hostname
  10.     if {[onchan [lindex $args 0]]} {
  11.         set host [maskhost [getchanhost [lindex $args 0]] 2]
  12.         set isnick 1
  13.     } else {
  14.         set host [lindex $args 0]
  15.     }
  16.    
  17.     #check for channel name
  18.     if {[validchan [lindex $args 1]]} {
  19.         set chan [lindex $args 1]
  20.         incr counter
  21.     } elseif {[validchan [lindex [console $idx] 0]]} {
  22.         set chan [lindex [console $idx] 0]
  23.     } else {
  24.         set valid 0
  25.     }
  26.    
  27.     if {$valid eq 1} {
  28.         if {[string match %* [lindex $args $counter]]} {
  29.             set duration 0
  30.             set s [string range [lindex $args $counter] 1 e]
  31.             if {$s ne 0} {
  32.                 set days [lindex [regexp "(\[0-9\]+)+d" $s] 1]
  33.                 if {$days ne ""} { incr duration $days*1440 }
  34.                 set hours [lindex [regexp "(\[0-9\]+)+h" $s] 1]
  35.                 if {$hours ne ""} { incr duration $hours*60 }
  36.                 set minutes [lindex [regexp "(\[0-9\]+)+m" $s] 1]
  37.                 if {$minutes ne ""} { incr duration $minutes }
  38.                
  39.             }
  40.             incr counter
  41.         } else {
  42.             set duration ${ban-time}
  43.         }
  44.     }
  45.    
  46.     if {$valid eq 1} {
  47.         set reason [lrange $args $counter e]
  48.         if {$reason eq ""} { set reason "Requested" }
  49.        
  50.         if {![matchattr [idx2hand $idx] o|o $chan]} {
  51.             putdcc $idx "Sorry, but you do not have enough access to perform this command"
  52.             return 0
  53.         }
  54.        
  55.         if {$isnick eq 1} {
  56.             putserv [format "KICK %s %s :%s" $chan $nick $reason]
  57.         } else {
  58.             foreach user [chanlist $chan] {
  59.                 if {[matchaddr [getchanhost $user] $host]} {
  60.                     putserv [format "KICK %s %s :%s" $chan $user $reason]
  61.                 }
  62.             }
  63.         }
  64.         newchanban $chan $host [idx2hand $idx] $reason $duration
  65.     } else {
  66.         putdcc $idx [format "Usage: .%s <nick|hostmask> \[channel\] \[%s<XdXhXm>\] \[reason\]" $lastbind "%"]
  67.         return 0
  68.     }
  69.     return 1
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement