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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
|
# Author : Infernius
# Contact-
# IRC : #infernius on Quakenet
# Email : infernius@gmail.com
# More scripts: http://v1per.servicez.org
set chanlev(author) "infernius"
set chanlev(version) "3.0"
# Description
# This script will handle your channels' user flags.
# You can add, remove and view flags.
# Usage
# $chanlev - Returns the chanlev stats -
# <bot> Chanlev stats for #infernius
# <bot> Total: 9 (max 30 users) (owner: 2, master: 5, op: 2, voice: 0).
# $chanlev <user|#authname> - Will return that person's flags for that channel.
# fx: Infernius has +amo on #v1per.
# $chanlev <user|#authname> <flags> - This will set those flags on that person.
# The owner flag has been left out due to possible abuse which can lead to takeovers :)
# Configuration
# Your trigger!
set chanlev(trigger) "+"
# Lock out the owner flag for this script?
# 1 = yes, 0 = no
set chanlev(lockout) "1"
# Future plans
# Make 1 big proc to hande all responses.
# The only reason i made it like this is because i started out with a simple adding script,
# Later on, i added chanflags support and chanlev stats/chanlev viewer of flags support.
# Bind
bind PUB n|n ${chanlev(trigger)}chanlev pub:chanlev
bind PUB n|n ${chanlev(trigger)}chanflags pub:chanflags
# Procs. Don't touch these :)
proc pub:chanlev { nickname hostname handle channel arguments } {
global chanlev
set target [lindex [split $arguments] 0]
if {$target == ""} {
set chanserv [cserve $channel]
set chanlev(channel) $channel
if {$chanserv == "L"} {
bind notc -|- * chanlev:l:stats
putquick "PRIVMSG $chanserv :chanlev $channel"
} elseif {$chanserv == "Q"} {
bind notc -|- * chanlev:q:stats
putquick "PRIVMSG $chanserv :chanlev $channel"
} else {
putquick "NOTICE $nickname :There is no channel service on this channel."
return 0
}
} else {
set flags [lindex [split $arguments] 1]
if {$flags == ""} {
set chanserv [cserve $channel]
set chanlev(channel) $channel
if {$chanserv == "L"} {
bind notc -|- * l:reaction
putquick "PRIVMSG $chanserv :chanlev $channel $target"
}
if {$chanserv == "Q"} {
bind notc -|- * q:reaction
putquick "PRIVMSG $chanserv :chanlev $channel $target"
}
} else {
if {$chanlev(lockout) == "1" && [string match -nocase *n* $flags]} {
putquick "NOTICE $nickname :12,1•0,1• Sorry, Can't add the ownerflag due to safety protocols. 12,1•0,1•"
return 0
}
set chanserv [cserve $channel]
set chanlev(target) $target ; set chanlev(flags) $flags ; set chanlev(nick) $nickname ; set chanlev(channel) $channel ; set chanlev(chanserv) $chanserv
putquick "PRIVMSG $chanserv :chanlev $channel $target $flags"
bind notc -|- * chanlev:reaction
}
}
}
proc pub:chanflags { nickname hostname handle channel arguments } {
global chanflag
set flags [lindex [split $arguments] 0]
if {$flags == ""} {
if {![onchan Q $channel]} {
putquick "PRIVMSG $channel :12,1•0,1• Sorry but there is no Q bot here. Cannot proceed. 12,1•0,1•"
return 0
}
set chanflag(chan) $channel ; set chanflag(nick) $channel
bind NOTC -|- * chanflags:q:reaction
putquick "PRIVMSG Q :chanflags $channel"
} else {
set chanflag(chan) $channel ; set chanflag(nick) $nickname ; set chanflag(flag) $flags
bind NOTC -|- * chanflags:q:error
putquick "PRIVMSG Q :chanflags $channel $flags"
}
}
proc chanflags:q:error { nickname hostname handle arguments **** } {
global chanflag
set from "${nickname}!${hostname}"
if {[regexp -nocase -- {^(Q!TheQBot@CServe.quakenet.org)$} $from]} {
if {[regexp -nocase -- {^You have to be owner or master to change the CHANFLAGS} $arguments]} {
putquick "PRIVMSG $chanflag(chan) :12,1•0,1• I do not have master or owner access on Q 12,1•0,1•"
unbind NOTC -|- * chanflags:q:error
return 0
}
if {[regexp -nocase -- {^Done.} $arguments]} {
putquick "PRIVMSG $chanflag(chan) :12,1•0,1• Done. 12,1•0,1•"
putquick "NOTICE $chanflag(nick) :$chanflag(flag) has been set on $chanflag(chan)"
unbind NOTC -|- * chanflags:q:error
return 0
}
}
}
proc chanflags:q:reaction { nickname hostname handle arguments **** } {
global chanflag
set from "${nickname}!${hostname}"
if {[regexp -nocase -- {^(Q!TheQBot@CServe.quakenet.org)$} $from]} {
if {[regexp -nocase -- {^Current channel flags are: (.*?)$} $arguments tmp flags]} {
putquick "PRIVMSG $chanflag(chan) :12,1•0,1• Current channel flags are: $flags 12,1•0,1•"
unbind NOTC -|- * q:reaction
return 0
}
}
}
proc chanlev:q:stats { nickname hostname handle arguments **** } {
global chanlev
set from "${nickname}!${hostname}"
if {[regexp -nocase -- {^(Q!TheQBot@CServe.quakenet.org)$} $from]} {
if {[regexp -nocase -- {^You are not known or banned on this channel and can't dump the userlist!} $arguments]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• I don't have any flags on Q 12,1•0,1•"
unbind notc -|- * chanlev:q:stats
return 0
}
if {[regexp -nocase -- {^Total:\s(.*?)\s\(owner:\s(.*?),\smaster:\s(.*?),\sop:\s(.*?),\svoice:\s(.*?)\sknown:\s(.*?)(,\sban:\s(.*?))?\)\.$} $arguments tmp total owner master op voice known tmp ban]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• Chanlev stats for $chanlev(channel) 12,1•0,1•"
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• Total: $total 12,1•0,1• Owner: ${owner} 12,1•0,1• Master: ${master} 12,1•0,1• Op: ${op} 12,1•0,1• Voice: ${voice} 12,1•0,1• Known: ${known} 12,1•0,1• Ban: ${ban} 12,1•0,1•"
unbind notc -|- * chanlev:q:stats
return 0
}
}
}
proc chanlev:l:stats { nickname hostname handle arguments **** } {
global chanlev
set from "${nickname}!${hostname}"
if {[regexp -nocase -- {^(L!TheLBot@lightweight.quakenet.org)$} $from]} {
putlog "Getting a message from L!"
if {[regexp -nocase -- {^Sorry, you do not have permission to view/change user flags on (.*).} $arguments tmp channel]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• I don't have any flags on L 12,1•0,1•"
unbind notc -|- * chanlev:l:stats
return 0
}
if {[regexp {^.*Total: (.*?) \(max 30 users\) \(owner: (.*?), master: (.*?), op: (.*?), voice: (.*?)\).*} $arguments tmp total owner master op voice]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• Chanlev stats for $chanlev(channel) 12,1•0,1•"
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• Total: $total 12,1•0,1• Owner: ${owner} 12,1•0,1• Master: ${master} 12,1•0,1• Op: ${op} 12,1•0,1• Voice: ${voice} 12,1•0,1•"
unbind notc -|- * chanlev:l:stats
return 0
}
}
}
proc q:reaction { nickname hostname handle arguments **** } {
global chanlev
set from "${nickname}!${hostname}"
if {[regexp -nocase -- {^(Q!TheQBot@CServe.quakenet.org)$} $from]} {
if {[regexp -nocase -- {^You are not known or banned on this channel and can't dump the userlist!} $arguments]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• I don't have any flags on Q 12,1•0,1•"
unbind notc -|- * q:reaction
return 0
}
if {[regexp -nocase -- {^Can't find that nickname. If the user isn't logged on, but is known by Q} $arguments]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• I'm afraid that user isn't authed. 12,1•0,1•"
unbind notc -|- * q:reaction
return 0
}
if {[regexp -nocase -- {^Flags for (.*?) on (#.*?): (.*?)$} $arguments tmp auth chan flags]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• $auth has $flags on $chan 12,1•0,1• "
unbind notc -|- * q:reaction
return 0
} else {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• User is not known on $chanlev(channel) 12,1•0,1•"
unbind notc -|- * q:reaction
return 0
}
}
}
proc l:reaction { nickname hostname handle arguments **** } {
global chanlev
set from "${nickname}!${hostname}"
if {[regexp -nocase -- {^(L!TheLBot@lightweight.quakenet.org)$} $from]} {
if {[regexp -nocase -- {^Sorry, you do not have permission to view/change user flags on (.*)} $arguments tmp channel]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• I don't have any flags on L 12,1•0,1•"
unbind notc -|- * l:reaction
return 0
}
if {[regexp -nocase -- {^(.*) is not known on (.*).} $arguments tmp auth channel]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• $auth is not known on $channel 12,1•0,1•"
unbind notc -|- * l:reaction
return 0
}
if {[regexp -nocase -- {^Unknown user (.*)} $arguments tmp auth]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• Unknown user $auth 12,1•0,1•"
unbind notc -|- * l:reaction
return 0
}
if {[llength $arguments] == 2} {
if {[regexp -nocase -- {^([^ ]*) *(.*)} $arguments tmp auth modes]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• $auth has $modes on $chanlev(channel) 12,1•0,1•"
unbind notc -|- * l:reaction
}
}
}
}
proc chanlev:reaction {nickname hostname handle arguments ****} {
global chanlev
set from "${nickname}!${hostname}"
if {[regexp -nocase -- {^(Q!TheQBot@CServe.quakenet.org|L!TheLBot@lightweight.quakenet.org)$} $from]} {
if {[regexp -nocase -- {You do not have sufficient access|you do not have permission|You are not known or banned} $arguments]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• I have no access to $chanlev(chanserv) on this channel. 12,1•0,1•"
unbind notc - * chanlev:reaction
return 0
}
if {[regexp -nocase -- {You have to be master to change|You're not the owner or a master|Only owners can add or remove the master flag.} $arguments]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• I do not have the master flag for $chanlev(channel) 12,1•0,1•"
unbind notc - * chanlev:reaction
return 0
}
if {[regexp -nocase -- {You have to be owner to change|Only owners can change|Only owners can add or remove} $arguments]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• I do not have the owner flag for $chanlev(channel) 12,1•0,1•"
unbind notc - * chanlev:reaction
return 0
}
if {[regexp -nocase -- {Done.} $arguments]} {
putquick "PRIVMSG $chanlev(channel) :12,1•0,1• Done. 12,1•0,1•"
putquick "NOTICE $chanlev(nick) :$chanlev(target)'s flags were changed to $chanlev(flags) on $chanlev(channel)"
unbind notc - * chanlev:reaction
return 0
}
unbind notc - * chanlev:reaction
}
}
proc cserve {channel} {
if {[onchan Q $channel]} {return "Q"} elseif {[onchan L $channel]} {return "L"} else {return ""}
}
putlog "Chanlev $chanlev(version) loaded! Made by $chanlev(author)"
|