This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Badnick script

Old posts that have not been replied to for several years.
Locked
s
sys
Voice
Posts: 19
Joined: Mon Sep 24, 2001 8:00 pm
Location: Middle East

Badnick script

Post by sys »

I need help in this small script please.
This tcl script kick/ban a certain nick on changed. I want the script also to kick/ban a same nick on join with ban time, and on specific channels.
such as:
set bandnickchan "#chan1 #chan2"

Thank you.

## code ##

## Badnick scans
set badnicks {
"[censored]"
"bitch"
"asshole"
}

bind nick - * Detected_changebad

proc Detected_changebad {nick uhost hand chan newnick} {
global badnicks botnick
if {(![matchattr $hand b]) && ($nick != $botnick)} {
foreach badchange [string tolower $badnicks] {
if {[string match *$badchange* [string tolower $newnick]]} {
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
putserv "MODE $chan +b $banmask"
putserv "KICK $chan $newnick :Please do not use Badnick on this channel"
return 0
}
}
}
}
M
Mapherick

Post by Mapherick »

a solution would be:

Code: Select all

## Badnick scans 
set bnick_nicks {
"badnick"
}

## channels to watch
set bnick_chans {
"#badchan"
}

## ban time in minutes (0 == perm)  
set bnick_time 60

bind nick - * bnick_nick
bind join - * bnick_join

proc bnick_nick {nick uhost hand chan newnick} {
  global bnick_chans
  foreach ch $bnick_chans {
    if {[onchan $newnick $ch]} {
      bnick_check $newnick $uhost $hand $chan
      return 1
    }
  }
  return 0
}

proc bnick_join {nick uhost hand chan} {
  global bnick_chans
  foreach ch $bnick_chans {
    if {[onchan $nick $ch]} {
      bnick_check $nick $uhost $hand $chan
      return 1
    }
  }
  return 0
}

proc bnick_check {nick uhost hand chan} {
  global bnick_nicks botnick bnick_time
  if {([matchattr $hand b]) || ($nick == $botnick)} {return 0}
  foreach badnick $bnick_nicks {
    if {[string match "*[string tolower $badnick]*" [string tolower $nick]]} {
      set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
      newchanban $chan $uhost $botnick "Please do not use $badnick on this channel" $bnick_time none
      return 0
    }
  }
}
BTW: Perm banning [badnick]!*@* works as well ofcourse ;)
s
sys
Voice
Posts: 19
Joined: Mon Sep 24, 2001 8:00 pm
Location: Middle East

Post by sys »

Thank you Mapherick :)
Locked