-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathignore.tcl
More file actions
80 lines (70 loc) · 3.95 KB
/
ignore.tcl
File metadata and controls
80 lines (70 loc) · 3.95 KB
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
# $Id: ignore.tcl,v1 15/07/2012 05:41:42am GMT +12 (NZST) IRCSpeed Exp $
# Commands:
# ---------
# Public: !ignore add *!*host@mask.etc timehere your-reasons-for-ignore
# !ignore del *!*host@mask.etc
# !ignores
# The trigger
set ignorepubtrig "!"
# Set Flags here to trigger script (Note: default flag is 'o' (global op), it's not wise to use lower flags as someone could
# add owners to ignore. Only add a flag for Respected Bot User's who don't abuse their access.
set ignoreflags o
# ---- EDIT END ----
proc getIgnoreTrig {} {
global ignorepubtrig
return $ignorepubtrig
}
bind pub - ${ignorepubtrig}ignore ignore:pub
bind pub - ${ignorepubtrig}ignores ignore:list
proc ignore:pub {nick uhost hand chan text} {
global ignoreflags
if {[matchattr [nick2hand $nick] $ignoreflags]} {
if {[lindex [split $text] 0] == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getIgnoreTrig]ignore add <*!*@host.mask.whatever> <duration:in:minutes> <your reasons whatever> - [getIgnoreTrig]ignore del <*!*@host.mask.whatever>"; return}
if {[lindex [split $text] 0] == "add"} {
set addmask [lindex [split $text] 1]
if {$addmask == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getIgnoreTrig]ignore add <*!*@host.mask.whatever> <duration:in:minutes> <your reasons whatever> - [getIgnoreTrig]ignore del <*!*@host.mask.whatever>"; return}
if {[isignore $addmask]} {putquick "PRIVMSG $chan :\037ERROR\037: This is already a Valid Ignore."; return}
set duration [lindex [split $text] 2]
if {$duration == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getIgnoreTrig]ignore add <*!*@host.mask.whatever> <duration:in:minutes> <your reasons whatever> - [getIgnoreTrig]ignore del <*!*@host.mask.whatever>"; return}
set reason [join [lrange [split $text] 3 end]]
if {$reason == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getIgnoreTrig]ignore add <*!*@host.mask.whatever> <duration:in:minutes> <your reasons whatever> - [getIgnoreTrig]ignore del <*!*@host.mask.whatever>"; return}
newignore $addmask $hand "$reason" $duration
putquick "PRIVMSG $chan :\002New Ignore\002: $mask - \002Duration\002: $duration minutes - \002Reason\002: $reason"
return 0
}
if {[lindex [split $text] 0] == "del"} {
set delmask [lindex [split $text] 1]
if {$delmask == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getIgnoreTrig]ignore add <*!*@host.mask.whatever> <duration:in:minutes> <your reasons whatever> - [getIgnoreTrig]ignore del <*!*@host.mask.whatever>"; return}
if {![isignore $delmask]} {putquick "PRIVMSG $chan :\037ERROR\037: This is NOT a Valid Ignore."; return}
killignore $delmask
putquick "PRIVMSG $chan :\002Removed Ignore\002: $mask"
return 0
}
}
}
proc ignore:list {nick uhost hand chan text} {
if {[matchattr [nick2hand $nick] o]} {
if {[ignorelist] == ""} {
putquick "NOTICE $nick :\002There are Currently no Ignores\002"
} else {
putquick "NOTICE $nick :\002Current Ignore List\002"
foreach ignore [ignorelist] {
set ignoremask [lindex $ignore 0]
set ignorecomment [lindex $ignore 1]
set ignoreexpire [lindex $ignore 2]
set ignoreadded [lindex $ignore 3]
set ignorecreator [lindex $ignore 4]
set ignoreexpire_ctime [ctime $ignoreexpire]
set ignoreadded_ctime [ctime $ignoreadded]
if {$ignoreexpire == 0} {
set ignoreexpire_ctime "perm"
}
putserv "NOTICE $nick : "
putserv "NOTICE $nick :\002Mask\002: $ignoremask - \002Set by\002: $ignorecreator."
putserv "NOTICE $nick :\002Reason\002: $ignorecomment"
putserv "NOTICE $nick :\002Created\002: $ignoreadded_ctime. - \002Expiration\002: $ignoreexpire_ctime."
}
}
}
}
putlog ".:Loaded:. ignore.tcl - istok @ IRCSpeed"