This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbadwords_regex.tcl
158 lines (144 loc) · 3.85 KB
/
badwords_regex.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License
# http://creativecommons.org/licenses/by-sa/3.0/
# savvas @ Undernet, Freenode
# http://www.hellnetworks.com
# Detects bad words/swearing and bans/kicks the person with a specific ban lifetime.
# Add a channel to protect: .chanset #channel +badwords
# General Status:
set bwordsstatus "on"
# Ignore/Protect operators (+o) and voiced persons (+v)?
set bwordsignore "ov"
# The lists
set bwordslist {
"*putsomethinghere*"
}
set bwordslistre {
{(\ygam(?:[hi][aesow]|[wo](?!u?s\y)))}
{(\ypo?uts[aoe])}
{(\ykavl[aioe])}
{(\yar[hx]idia?)}
{(\yp[o0]?utan)}
{(\yvill?[aoi])}
{(vill?[aoi](?:us)?\y)}
{(po?utt?[oia](?!ut))}
{(\yskat[aoi])}
{(\ymo?[uy]nn?i\y)}
{(\yassh[o0]le\y)}
{(\yb[1i]tch\y)}
{(\ydic?khead\y)}
{(\ysh[1i]thead\y)}
{(\yfag(?:get)?s?\y)}
{(\yf[ua]c?k(?:er)?s?\y)}
{(\ysuc?k(?:er)?s?\y)}
{(\ygam[ih](?:th|8)[oweih]\y)}
{(\yk[0o]ts[1i]r(?:[0oi]|a(?!s\y)))}
{(\ypipp?a)}
{(\yfamo?u\s?t[ao])}
{(\yk[ow]lo)}
{(\ypenis\y)}
{(\ygay\y)}
{(\yrape\y)}
{(\ybadwa\y)}
{(\yphudi\y)}
{(\yfudi\y)}
{(\ylun\y)}
{(\ygand(?:u|oo)\y)}
{(\ypussy\y)}
{(\yboobs\y)}
{(\ychood\y)}
{(\ysux\y)}
{(\ybastard\y)}
{(\ycock\y)}
{(\ycunt\y)}
{(\yommak\y)}
{(\yshit\y)}
{(\ypus?sy\y)}
{(\ywhore\y)}
{(\yslut\y)}
}
# Ban time (minutes)
set bwordstime 2
# Ban type
# 0: *!*@host
# 1: *!user@host
# 2: nick!*@host
# 3: nick!user@*
# 4: nick!user@host
set bwordsbtype 0
# Don't edit from this point
# --------------------------
# Setting flag
setudef flag badwords
bind pubm - * checkbadwords
proc checkbadwords {nick userhost handle channel text} {
global bwordsstatus bwordsignore bwordslist bwordslistre bwordstime botnick bwordsbtype
if {$bwordsstatus == "off" || ![channel get $channel badwords]} {
return
}
if {[isop $nick $channel] && [string match *o* $bwordsignore]} {
return
}
if {[isvoice $nick $channel] && [string match *v* $bwordsignore]} {
return
}
if {[matchattr $handle fov|fov $channel]} {
return
}
set bwli 0
set bwordsfound 0
foreach item $bwordslistre {
if {[regexp -nocase $item $text bwordsmatch bwordssub1]} {
set bwordsmask [bwords_cmdbantype $nick $userhost]
newchanban $channel $bwordsmask $botnick "\[BWre${bwli}\] Swearing is not allowed - $bwordstime minute(s)" $bwordstime
putkick $channel $nick "\[BWre${bwli}\] Swearing is not allowed - $bwordstime minute(s)"
set bwordsfound 1
break
}
incr bwli
}
set bwli 0
#if regex didn't match...
if {!$bwordsfound} {
foreach item $bwordslist {
if {[string match $item $text]} {
set bwordsmask [bwords_cmdbantype $nick $userhost]
newchanban $channel $bwordsmask $botnick "\[BWwc${bwli}\] Swearing is not allowed - $bwordstime minute(s)" $bwordstime
putkick $channel $nick "\[BWwc${bwli}\] Swearing is not allowed - $bwordstime minute(s)"
break
}
incr bwli
}
}
}
proc bwords_cmdbantype {nick userhost} {
global bwordsbtype
regexp "(.+)@(.+)" $userhost matches user host
switch $bwordsbtype {
0 {return "*!*@$host"}
1 {return "*!$user@$host"}
2 {return "$nick!*@$host"}
3 {return "$nick!$user@*"}
4 {return "$nick!$user@$host"}
default {return "*!*@$host"}
}
}
#sectomin $baddcctime
#proc sectomin {seconds} {
# set mins [expr {$seconds / 60}]
# set secs [expr {$seconds % 60}]
# set data1 ""
# set data2 ""
# set mintxtpl "mins"
# set mintxt "min"
# set sectxtpl "secs"
# set sectxt "sec"
# if {$secs == 0} {
# if {$mins == 1} then {set data1 $mintxt} elseif {$mins > 1} then {set data1 $mintxtpl}
# return "$mins$data1"
# } else {
# if {$mins == 0} {set mins ""} elseif {$mins == 1} then {set data1 $mintxt} elseif {$mins > 1} then {set data1 $mintxtpl}
# if {$secs == 1} then {set data2 $sectxt} elseif {$secs > 1} then {set data2 $sectxtpl}
# return "$mins$data1$secs$data2"
# }
#}
putlog "BadWords 0.9 (with regular expressions) by savvas - www.hellnetworks.com"