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.

badword/swear script

Old posts that have not been replied to for several years.
Locked
A
AW

badword/swear script

Post by AW »

Hi, i couldn't figure out this.
i have a badword script, which works fine, but then i wrote a ctcp/ACTION procedure, which calls this working script, but i f anyone used /me text, gets kick....don't why

bind pubm - "*test1*" badword
bind pubm - "*test2*" badword

proc badword {nick uhost hand chan rest} {

............ its works fine

}

but when i have added this for ctcp/action

proc ctcp_badword {nick uhost hand chan keyword rest} {
badword $nick $uhost $hand $chan $rest
}

bind ctcp - ACTION ctcp_badword

its kick anyone use ACTION ..like /me hello..

any advise/suggestions please??
thanks
regards
aW
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

With the pubm bind, you are testing for *test1* or *test2*. But in the ctcp bind, you call badword every time there is an action.

Just add in a test to make sure the bad word is in the $rest variable. Use 'string match' or 'regexp'.
A
AW

Post by AW »

Thanks, but could you please give me an example, how to do this?/
thanks
regards'
AW
A
AW

Post by AW »

Hi,

i'll appreciate if someone can help me with this, may be an example, i never worked with regexp stuff, or any advise for another solution plz?
thanks
regards
Aw
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

proc ctcp_badword {nick uhost hand chan keyword rest} { 
  if {[string match "somebadword" $rest]} {
    badword $nick $uhost $hand $chan $rest 
  }
} 
or if u set up a list of bad words u could do a loop on them

Code: Select all

set badwordlist "word1 word2 word3......"
proc ctcp_badword {nick uhost hand chan keyword rest} {
  global badwordlist 
  foreach badword "$badwordlist" {
    if {[string match "$badword" $rest]} {
      set rest "$badword"
      badword $nick $uhost $hand $chan $rest
    }
  }
}

Elen sila lúmenn' omentielvo
A
AW

Post by AW »

Thanks Papillon, it helped a lot, i have changed the setup, its working, but its not efficient, i'll appreciate if someone can look these codes and help me to make them more efficient, perfect codes...thanks

set badwordlist {
"test1"
"*test2*"
.
.
.

}
proc badword {nick uhost hand chan rest} {
putlog "$nick $uhost $hand $chan $rest"
global channel botnick badwordlist
foreach badword "$badwordlist" {
if {[string match "$badword" $rest]} {
set rest "$badword"
.
.
.
}
}
}
proc ctcp_badword {nick uhost hand chan keyword rest} {
badword $nick $uhost $hand $chan $rest
}

bind pubm - * badword
bind ctcp - ACTION ctcp_badword

i have this line -> putlog "$nick $uhost $hand $chan $rest" just to see in a partyline, but now cos of this, if any user type anything, shows in the partyline..

thanks
regards
aw
r
rambo

it`s work perfectly

Post by rambo »

try this one :o

Code: Select all

set badword {
 badword1
 badword2
}
bind pubm - * checkword
proc checkword {nick uhost handle chan text} {
 global badword
 if (![matchattr $nick +o]) {
  foreach n $badword {
   if ([string match $n [string tolower $text]]) {
    putlog "$nick said bad word in $chan - $n"
    putkick $chan $nick "bad word,please don`t use it"
    return 0
   }
  }
 }
}
Locked