forked from Bero83/eggdrop-TCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noswear.tcl
112 lines (94 loc) · 3.99 KB
/
noswear.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
# $Id: noswear.tcl,v1 15/07/2012 10:18:58pm GMT +12 (NZST) IRCSpeed Exp $
# Commands:
# ---------
# PUBLIC: !noswear on
# PUBLIC: !noswear off
# MSG: /msg yourbot noswear #channelname on
# MSG: /msg yourbot noswear #channelname off
#NOTE: Available to Global OP (o) and above, Channel Master (m) and above.
# Set global trigger here
set sweartrig "!"
# Set global access flags (default: o)
set swearglobflags o
# Set channel access flags (default: m)
set swearchanflags m
# Set your swearword pattern below
set swearwords {
"*fuck*"
"*cunt*"
"*shit*"
}
# -----DONT EDIT BELOW-----
bind pub - ${sweartrig}noswear noswear:pub
bind msg - noswear noswear:msg
bind pubm - * noswear:text
bind ctcp - ACTION noswear:act
setudef flag noswear
proc swearTrigger {} {
global sweartrig
return $sweartrig
}
proc noswear:pub {nick uhost hand chan arg} {
global swearglobflags swearchanflags
if {![matchattr [nick2hand $nick] $swearglobflags|$swearchanflags $chan]} {return}
if {[lindex [split $arg] 0] == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [swearTrigger]noswear on|off"; return}
if {[lindex [split $arg] 0] == "on"} {
if {[channel get $chan noswear]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
channel set $chan +noswear
puthelp "PRIVMSG $chan :Enabled Swearing Protection for $chan"
}
if {[lindex [split $arg] 0] == "off"} {
if {![channel get $chan noswear]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
channel set $chan -noswear
puthelp "PRIVMSG $chan :Disabled Swearing Protection for $chan"
}
}
proc noswear:msg {nick uhost hand arg} {
global botnick swearglobflags swearchanflags
set chan [strlwr [lindex $arg 0]]
if {![matchattr [nick2hand $nick] $swearglobflags|$swearchanflags $chan]} {return}
if {![string match "*#*" $arg]} {return}
if {[lindex [split $arg] 0] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick noswear #channel on|off"; return}
if {[lindex [split $arg] 1] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick noswear $chan on|off"; return}
if {[lindex [split $arg] 1] == "on"} {
if {[channel get $chan noswear]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
channel set $chan +noswear
putquick "NOTICE $nick :Enabled Swearing Protection for $chan"
}
if {[lindex [split $arg] 1] == "off"} {
if {![channel get $chan noswear]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
channel set $chan -noswear
putquick "NOTICE $nick :Disabled Swearing Protection for $chan"
}
}
proc noswear:text {nick uhost hand chan arg} {
global swearwords
if {[channel get $chan noswear]} {
foreach pattern $swearwords {
if {[string match -nocase $pattern $arg]} {
if {![validuser [nick2hand $nick]] && ![isop $nick $chan] && ![isvoice $nick $chan]} {
putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]"
putquick "KICK $chan $nick :\002\037S\037\002wear-\002\037W\037\002ord \002\037D\037\002etected. Please cease use of profanity while in $chan - Thank you."
}
}
}
}
}
proc noswear:act {nick uhost hand dest key text} {
global swearwords
if {![string match "*#*" $dest]} {return}
set chan $dest
if {[channel get $chan noswear]} {
foreach pattern $swearwords {
if {[string match -nocase $pattern $text]} {
if {[botisop $chan] && ![isbotnick $nick]} {
if {[onchan $nick $chan] && ![validuser $hand] && ![isop $nick $chan] && ![isvoice $nick $chan]} {
putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]"
putquick "KICK $chan $nick :\002\037S\037\002wear-\002\037W\037\002ord \002\037D\037\002etected. Please cease use of profanity while in $chan - Thank you."
}
}
}
}
}
}
putlog "Loaded: NoSwear Module. - istok @ IRCSpeed"