-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathwhois.tcl
More file actions
236 lines (191 loc) · 8.41 KB
/
whois.tcl
File metadata and controls
236 lines (191 loc) · 8.41 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# $Id: whois.tcl,v1.3a 04/02/2015 06:23:31am GMT +12 (NZST) IRCSpeed Exp $
## Commands
# ----------
# !whoami - shows your own personal status info.
# !whois <nickname> - shows personal status info for <nickname>.
# /msg yourbot whois #channel <nickname>
# Set your global command trigger here (default set to ! <-)
set whoispubtrig "!"
# ----- NO EDITING -----
proc getWhoTrigger {} {
global whoispubtrig
return $whoispubtrig
}
bind pub - ${whoispubtrig}whoami whoami:pub
proc whoami:pub {nick uhost hand chan arg} {
if {![validuser [nick2hand $nick]]} {putquick "NOTICE $nick :\037ERROR\037: You are NOT known to me."; return}
if {![regexp c [getchanmode $chan]]} {
putquick "PRIVMSG $chan :\002Nick\002: $nick ($uhost) - \002Handle\002: [nick2hand $nick] - \002Flags\002: [chattr [nick2hand $nick] $chan]"
if {[matchattr [nick2hand $nick] n]} {
putquick "PRIVMSG $chan :You are an \002Administrator\002 for my Bot Group"
return 0
}
if {[matchattr [nick2hand $nick] m]} {
putquick "PRIVMSG $chan :You are a \002Co Administrator\002 for my Bot Group"
return 0
}
if {[matchattr [nick2hand $nick] o]} {
putquick "PRIVMSG $chan :You are a \002Global Operator\002 for my Bot Group"
return 0
}
if {[matchattr [nick2hand $nick] |n $chan]} {
putquick "PRIVMSG $chan :You are a \002Channel Owner\002 for $chan"
return 0
}
if {[matchattr [nick2hand $nick] |m $chan]} {
putquick "PRIVMSG $chan :You are a \002Channel Master\002 for $chan"
return 0
}
if {[matchattr [nick2hand $nick] |o $chan]} {
putquick "PRIVMSG $chan :You are a \002Channel Operator\002 for $chan"
return 0
}
if {[matchattr [nick2hand $nick] |v $chan]} {
putquick "PRIVMSG $chan :You are a \002Channel Voice\002 for $chan"
return 0
}
}
if {[regexp c [getchanmode $chan]]} {
putquick "PRIVMSG $chan :Nick: $nick ($uhost) - Handle: [nick2hand $nick] - Flags: [chattr [nick2hand $nick] $chan]"
if {[matchattr [nick2hand $nick] n]} {
putquick "PRIVMSG $chan :You are an Administrator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $nick] m]} {
putquick "PRIVMSG $chan :You are a Co Administrator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $nick] o]} {
putquick "PRIVMSG $chan :You are a Global Operator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $nick] |n $chan]} {
putquick "PRIVMSG $chan :You are a Channel Owner for $chan"
return 0
}
if {[matchattr [nick2hand $nick] |m $chan]} {
putquick "PRIVMSG $chan :You are a Channel Master for $chan"
return 0
}
if {[matchattr [nick2hand $nick] |o $chan]} {
putquick "PRIVMSG $chan :You are a Channel Operator for $chan"
return 0
}
if {[matchattr [nick2hand $nick] |v $chan]} {
putquick "PRIVMSG $chan :You are a Channel Voice for $chan"
return 0
}
}
}
bind pub - ${whoispubtrig}whois whois:pub
proc whois:pub {nick uhost hand chan arg} {
if {![matchattr [nick2hand $nick] o|ovf $chan]} {putquick "NOTICE $nick :ERROR: You do not have access to this command."; return}
set whoisnick [lindex [split $arg] 0]
if {($whoisnick == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getWhoTrigger]whois nickname"; return}
if {($whoisnick == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getWhoTrigger]whois nickname"; return}
if {![validuser [nick2hand $whoisnick]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $whoisnick is an Unknown User."; return}
if {![validuser [nick2hand $whoisnick]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $whoisnick is an Unknown User."; return}
if {![regexp c [getchanmode $chan]]} {
putquick "PRIVMSG $chan :\002Nick\002: $whoisnick ([getchanhost $whoisnick $chan]) - \002Handle\002: [nick2hand $whoisnick] - \002Flags\002: [chattr [nick2hand $whoisnick] $chan]"
if {[matchattr [nick2hand $whoisnick] n]} {
putquick "PRIVMSG $chan :$whoisnick is an \002Administrator\002 for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] m]} {
putquick "PRIVMSG $chan :$whoisnick is a \002Co Administrator\002 for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] o]} {
putquick "PRIVMSG $chan :$whoisnick is a \002Global Operator\002 for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] |n $chan]} {
putquick "PRIVMSG $chan :$whoisnick is a \002Channel Owner\002 for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |m $chan]} {
putquick "PRIVMSG $chan :$whoisnick is a \002Channel Master\002 for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |o $chan]} {
putquick "PRIVMSG $chan :$whoisnick is a \002Channel Operator\002 for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |v $chan]} {
putquick "PRIVMSG $chan :$whoisnick is a \002Channel Voice\002 for $chan"
return 0
}
}
if {[regexp c [getchanmode $chan]]} {
putquick "PRIVMSG $chan :Nick: $whoisnick ([getchanhost $whoisnick $chan]) - Handle: [nick2hand $whoisnick] - Flags: [chattr [nick2hand $whoisnick] $chan]"
if {[matchattr [nick2hand $whoisnick] n]} {
putquick "PRIVMSG $chan :$whoisnick is an Administrator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] m]} {
putquick "PRIVMSG $chan :$whoisnick is a Co Administrator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] o]} {
putquick "PRIVMSG $chan :$whoisnick is a Global Operator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] |n $chan]} {
putquick "PRIVMSG $chan :$whoisnick is a Channel Owner for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |m $chan]} {
putquick "PRIVMSG $chan :$whoisnick is a Channel Master for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |o $chan]} {
putquick "PRIVMSG $chan :$whoisnick is a Channel Operator for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |v $chan]} {
putquick "PRIVMSG $chan :$whoisnick is a Channel Voice for $chan"
return 0
}
}
}
bind msg - whois whois:msg
proc whois:msg {nick uhost hand arg} {
global botnick
if {![string match "*#*" $arg]} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick whois #channel nickname"; return}
set chan [lindex [split $arg] 0]
if {![matchattr [hand2nick $hand] o|m $chan]} {putquick "NOTICE $nick :\037ERROR\037: You do not have access to this command."; return}
if {$chan == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick whois #channel nickname"; return}
set whoisnick [lindex [split $arg] 1]
if {$whoisnick == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick whois $chan nickname"; return}
if {![validuser [nick2hand $whoisnick]]} {putquick "NOTICE $nick :$whoisnick is an Unknown User."; return}
putquick "NOTICE $nick :\002Nick\002: $whoisnick ([getchanhost $whoisnick $chan]) - \002Handle\002: [nick2hand $whoisnick] - \002Flags\002: [chattr [nick2hand $whoisnick] $chan]"
if {[matchattr [nick2hand $whoisnick] n]} {
putquick "NOTICE $nick :$whoisnick is an Administrator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] m]} {
putquick "NOTICE $nick :$whoisnick is a Co Administrator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] o]} {
putquick "NOTICE $nick :$whoisnick is a Global Operator for my Bot Group"
return 0
}
if {[matchattr [nick2hand $whoisnick] |n $chan]} {
putquick "NOTICE $nick :$whoisnick is a Channel Owner for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |m $chan]} {
putquick "NOTICE $nick :$whoisnick is a Channel Master for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |o $chan]} {
putquick "NOTICE $nick :$whoisnick is a Channel Operator for $chan"
return 0
}
if {[matchattr [nick2hand $whoisnick] |v $chan]} {
putquick "NOTICE $nick :$whoisnick is a Channel Voice for $chan"
return 0
}
}
putlog ".:LOADED:. whois.tcl,v1.3a - istok @ IRCSpeed"