-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeluser.etcl
executable file
·67 lines (63 loc) · 2.88 KB
/
deluser.etcl
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
###
# Usage: /msg botnick deluser [<channel>] <nick1> [<nick2> <nick3> ..]
###
### DELUSER:
bind msg - deluser "msg_error msg_deluser"
bind pub - $set(cmd)deluser "pub_error pub_deluser"
### CHANNEL:
proc pub_deluser {nick uhost handle chan text} {
if {[validuser $handle]} {
all_deluser c $nick $uhost $handle $chan $text
}
}
### QUERY:
proc msg_deluser {nick uhost handle text} {
if {![validuser $handle]} {
return
} elseif {[lindex $text 0] == ""} {
notice $nick $handle "Invalid request: Wheres the channel name?"
} elseif {![string match #* [lindex $text 0]]} {
notice $nick $handle "Invalid request: [lindex $text 0] is not a channel"
} else {
all_deluser m $nick $uhost $handle [lindex $text 0] [lrange $text 1 end]
}
}
### MAIN:
proc all_deluser {type nick uhost handle chan text} {
global set botnick
chan_settings deluser $type $nick $uhost $handle $chan $text
if {[level $handle $chan] == "0" || ![auth_check $nick $uhost $handle $chan] || [backup_check $chan]} {
return
} elseif {![validchan $chan]} {
notice $nick $handle "Invalid request: $chan is not a valid channel"
} elseif {[string tolower $type] == "c" && [changet $chan nochanmsg]} {
notice $nick $handle "$set(cmd)commands have been disabled for $chan"
} elseif {[level $handle $chan] < [comget $chan deluser]} {
notice $nick $handle "Your level of [level $handle $chan] is less then the required [comget $chan deluser] for this command"
} elseif {[lindex $text 0] == ""} {
notice $nick $handle "Invalid request: What nick are you deleting?"
} else {
foreach u $text {
if {[string tolower $u] == [string tolower $set(chanserv)]} {
notice $nick $handle "$set(chanserv) (Channel Service) is unable to recieve access in any channels, therefore cannot be removed from any."
} elseif {[level $u $chan] == "0"} {
notice $nick $handle "$u is not currently in the $chan database"
} elseif {[level $u $chan] == [level $handle $chan]} {
notice $nick $handle "$u's level of [level $u $chan] in $chan is currently equal to your level of [level $handle $chan]"
} elseif {[level $u $chan] > [level $handle $chan]} {
notice $nick $handle "$u's level of [level $u $chan] in $chan is currently higher than your level of [level $handle $chan]"
} else {
-user $u $chan
notice $nick $handle "Removed $u's access from $chan"
if {[changet $chan telladd]} {
noteownersend $chan "($handle) $nick!$uhost deleted $u from $chan"
}
}
}
putcmdlog "> !$handle! ($nick!$uhost) DELUSER\[$type\] ($chan): $text"
homechan "\[$handle\]($nick!$uhost) deleted (tried to delete) these people from $chan: $text"
if {[changet $chan telldel]} {
noteownersend $chan "($handle) $nick!$uhost removed [lindex $text 0] from $chan"
}
}
}