 |
|
 |
|
MeBoy Comandant

Joined: 15 Aug 2007 Posts: 13
|
|
 |
|
 |
|
Posted: 15/08/2007 16:07 Post subject: AntiSwear.tcl |
|
|
| Code: | ######################################################################
# #
# antiswear.tcl ---> version 0,1 ( beta ) #
# Tested on: #
# Windrop v1.6.17 CYGWIN_NT with Tcl 8.4 #
# Basic usage guide: #
# .chanset #channel +antiswear #
# .swear -add <word> #
# .swear -del <word> #
# .swear -check <word> #
# .swear -list <word> #
# .swear <-add|-del|-check|-list> word #
# #
# ++ Requests a&a_light or LendingScript ++ #
# #
# #
# LICENSE: #
# This code comes with ABSOLUTELY NO WARRANTY. #
# #
# This program is free software; you can redistribute it #
# and/or modify it under the terms of the GNU General Public #
# License as published by the Free Software Foundation; #
# either version 2 of the License, or (at your option) any #
# later version. #
# #
# This program is distributed in the hope that it will be #
# useful, but WITHOUT ANY WARRANTY; without even the implied #
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR #
# PURPOSE. See the GNU General Public License for more #
# details. (http://www.gnu.org/copyleft/library.txt) #
# #
# Copyright (C) 2007, ReaL|DoG #
# #Lending @ Undernet. Support http://forum.ircproject.info #
# AntiSwear at http://script.ircproject.info #
# #
######################################################################
################## How to Install this script ########################
######################################################################
# #
# Create folder databases/antiswear/ in /eggdrop/ #
# Edit: local_n.tcl, aux.tcl #
# #
# #
# +++++++++++++++++++++++++++++++++++ #
# Edit Local_N.tcl #
# +++++++++++++++++++++++++++++++++++ #
# #
# Now, put this lines in local_n.tcl: #
a:command -add badnick pub:badnick 0000 000 |n
set sw(file) "databases/antiswear/$chan.db" ;# Here, you can set the folder where the files are going to be saved
proc pub:antiswear {hand chan args x mix} {
global settings sw
set where $chan
set opt [lindex $args 0] ;# Option
set word [lindex $args 1] ;# BadNick word
switch -- $opt {
-add {
if {![matchattr $hand -|n $chan]} {puthelp "privmsg $chan :If you want to use this command ( \002!swear -add\002 ) then you must be a $chan manager. (+N flag)"; return}
if {![file exists $sw(file)]} {
set fh [open $sw(file) w]
puts -nonewline $fh ""
close $fh
}
set fdz [open $sw(file) r]
set conte [read $fdz]
close $fdz
if {[string match -nocase "*$word*" $conte]} {puthelp "privmsg $chan :This swear (\002$word\002) already exists in the $chan swear database."; return }
set fd [open $sw(file) a+]
puts $fd "$word"
close $fd
puthelp "PRIVMSG $chan :Added swear \002$word\002 to the $chan database."
}
-del {
if {![matchattr $hand -|n $chan]} {puthelp "privmsg $chan :If you want to use this command ( \002!swear -del\002 ) then you must be a $chan manager. (+N flag)"; return}
set fd [open $sw(file) r]
set reads [read $fd]
close $fd
set data ""
if {![string match -nocase "*$word*" $reads]} {puthelp "privmsg $chan :This swear (\002$word\002) doesn't exist in the $chan swear database."; return }
if {[llength $reads]} {
set fd [open $sw(file) w]
foreach line [split $reads \n] {
if {![string match -nocase *$word* $line]} {
if {[llength $line]} {puts $fd "$line\n"}
}
}
close $fd
puthelp "PRIVMSG $chan :I removed the swear \002$word\002 from the $chan database."
}
}
-check {
if {![matchattr $hand -|- $chan]} {puthelp "privmsg $chan :If you want to use this command ( \002!swear -check\002 ) then you must be a $chan owner. (+n flag)"; return}
set fd [open $sw(file) r]
set cont [read $fd]
close $fd
if {![string match -nocase "*$word*" $cont]} {puthelp "privmsg $chan :This swear (\002$word\002) doesn't exist in the $chan swear database."; return }
foreach abuse [split $cont \n] {if {[string match -nocase "*$word*" $abuse]} {
set a1 [lindex $abuse 0]
puthelp "PRIVMSG $chan :The swear \002$a1\002 exists in the $chan swear database."}
}
}
-list {
if {![matchattr $hand -|N $chan]} {puthelp "privmsg $chan :If you want to use this command ( \002!swear -list\002 ) then you must be a $chan manager (+N flag)"; return}
set fd [open $sw(file) r]
set cont [read $fd]
close $fd
set listabuse ""
foreach abuse [split $cont \n] {lappend listabuse "\002[lindex $abuse 0]\002"}
puthelp "PRIVMSG $chan :I retrieved the following list from the $chan swear database: [join $listabuse]"
}
default {puthelp "privmsg $chan :Usage: !swear <-add|-del|-check|-list> word"}
}
}
############################################################
# Now, go to chanset process, and put there antiswear, like here:
# ie:
# [regexp {^[+-](antiswear|badnick|silent|auto(op|voice)|.....}
# Now save this file and close it.
# On a&a_light and Lending Script.. already exist this variable
# to work fine this script, you must to remove this line fron
# core.tcl at process:
# proc a:parse:anti {nick uhost hand chan text args} {
# THE LINE YOU MUST TO REMOVE IS:
#
# [channel get $chan antiswear] && ([string match *muie* $text] || [string match *[CENZURAT]* $text] || [string match *fuck* $text] || [string match *mata* $text] || [string match *[CENZURAT]* $text] || [string match *suck* $text] || [string match *dick* $text] || [string match *fut* $text])} {set why "Watch your language young boy! -antiswear"} elseif {
#
# now the script will work fine :).
#
#
############################################################
#
# ++++++++++++++++++++++++++++++++++++ #
# Edit aux.tcl #
# ++++++++++++++++++++++++++++++++++++ #
# Here put this lines: #
bind pubm -|- * pub:antisw
proc pub:antisw {nick uhost hand chan text} {
global username sw
set fd [open $antisw(file) r]
set cont [read $fd]
close $fd
foreach word [string tolower $cont] {
if {![channel get $chan antiswear] && [string match -nocase "*$word*" $text]} {return}
if {[matchattr $hand f|f $chan] && [string match -nocase "*$word*" $text]} {return}
if {[isop $nick $chan] && [string match -nocase "*$word*" $text]} {return}
if {[isvoice $nick $chan] && [string match -nocase "*$word*" $text]} {putquick "KICK $chan $nick :You should be banned at this moment. You're lucky that your voiced, anyway.. you're kicked."; return }
if {[string match *$word* [string tolower $text]]} {newchanban $chan [a:maskhost -host $uhost] $username "You're not allowed to use \002$word\002, or i'm wrong?... You're banned for [channel get $chan ban-time] minutes." [channel get $chan ban-time] sticky; putquick "kick $chan $nick :You're not allowed to use \002$word\002, or i'm wrong?... You're banned for [channel get $chan ban-time] minutes."}
}
}
################################################################
# Now save this file, aux.tcl and edit settings.conf. Here you #
# must to add, setudef flag swear. After that.. save and type #
# on IRC !rehash or !restart :) #
################################################################ |
|
|