Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ----------- Settings --------------
- alias -l chans { return # } ; The channel(s) that code to work
- alias -l bad_file { return badchans.txt } ; The bad channels location file
- alias -l ban_kick { return 1 } ; 1 = kick him yes, 0 = no kick just ban
- alias -l ban_time { return 300 } ; 0 = permanent, (use seconds only)
- alias -l ban_type { return 2 } ; use /help $mask for ban type
- alias -l auto_recheck_secs { return 0 } ; seconds for automatically rescan (whois) all nicknames, use 0 to disable it
- ; ----------- Settings --------------
- ON *:JOIN:$($chans): {
- if ($nick == $me) {
- if ($auto_recheck_secs) { .timer[CHECK_ $+ $chan $+ _BADCHANS] 0 $auto_recheck_secs recheck_all_badchans $chan }
- return
- }
- if ($me isreg $chan) { return }
- recheck_badchan $nick
- }
- ON *:PART:$($chans): { if ($nick == $me) { .timer[CHECK_ $+ $chan $+ _BADCHANS] off } }
- ON *:KICK:$($chans): { if ($knick == $me) { .timer[CHECK_ $+ $chan $+ _BADCHANS] off } }
- RAW *:*: {
- if (!$hget(BCS,0).item) || ($status !== connected) { return }
- haltdef
- var %h = $hget(BCS,$2)
- if ($numeric == 318) && (%h) { hdel BCS $2 }
- if ($numeric == 319) && (%h) {
- var %r = $check_badchans($3-)
- var %t = $comchan($2,0)
- if (!%r) || (!%t) { return }
- var %i = 1
- while (%i <= %t) {
- var %c = $comchan($2,%i)
- if ($me ison %c) && ($me isop %c) && ($2 ison %c) {
- inc %knum 1
- var %f = -
- if ($ban_kick) { var %f = %f $+ k }
- if ($ban_time) { var %f = %f $+ u $+ $ban_time }
- ban %f %c $2 $ban_type 4[Banned] (reason: You have been found in ( $+ $numtok(%r,32) $+ ) blacklisted channels ( $+ %r $+ ) -- for more infomation reagarding your ban please contact Kendy for removal -52- [Kick id: $chr(35) $+ %knum $+ ] (Expires in: $duration($ban_time) $+ )
- }
- inc %i
- }
- }
- }
- alias recheck_all_badchans {
- ; /recheck_all_badchans <#channel>
- if (!$1) || ($me !ison $1) || ($me !isop $1) || ($status !== connected) { return }
- var %t = $nick($1,0,r)
- if (!%t) { return }
- var %i = 1
- while (%i <= %t) {
- var %n = $nick($1,%i,r)
- if (%n) { .timer[SCAN_ $+ %n $+ _BADCHANS] 1 $calc(%i * 5) recheck_badchan %n }
- inc %i
- }
- }
- alias recheck_badchan {
- ; /recheck_badchan <nickname>
- if (!$1) || ($status !== connected) { return }
- hadd -mu10 BCS $1 1
- whois $1
- }
- alias -l check_badchans {
- ; $check_badchans(#channel1 #channel2 ...)
- if (!$1) || (!$file($bad_file)) { return }
- var %chans = $fix_badchans($1-)
- var %win = $+(@BD_,$crc($1-,0))
- if ($window(%win)) { window -c $v1 }
- window -hj10000000000000 %win
- loadbuf %win $qt($bad_file)
- var %t = $line(%win,0)
- var %i = 1
- while (%i <= %t) {
- var %r = $line(%win,%i)
- if (!%r) { goto next }
- if ($istok(%chans,%r,32)) { var %tot = $addtok(%tot,%r,32) | goto next }
- var %z = 1
- while (%z <= $numtok(%chans,32)) {
- var %n = $gettok(%chans,%z,32)
- if (%n) && (%r iswm %n) { var %tot = $addtok(%tot,%n,32) }
- inc %z
- }
- :next
- inc %i
- }
- window -c %win
- return $iif(%tot,$v1,0)
- }
- alias -l fix_badchans {
- ; $fix_badchans(@#channel1 ~#channel2 ...)
- if (!$1) { return 0 }
- var %t = $numtok($1-,32)
- var %i = 1
- while (%i <= %t) {
- var %o = $gettok($1-,%i,32)
- if (%o) { var %c = $+($chr(35),$right(%o,- $+ $pos(%o,$chr(35),1))) }
- if (%c) { var %tot = $addtok(%tot,%c,32) }
- inc %i
- }
- return $iif(%tot,$v1,0)
- }
Add Comment
Please, Sign In to add comment