-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopic.etcl
60 lines (49 loc) · 1.97 KB
/
topic.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
###
# Usage: /msg botnick topic [<channel>] [<topic>]
###
### TOPIC:
bind msg - topic "msg_error msg_topic"
bind pub - $set(cmd)topic "pub_error pub_topic"
### CHANNEL:
proc pub_topic {nick uhost handle chan text} {
if {[validuser $handle]} {
all_topic c $nick $uhost $handle $chan $text
}
}
### QUERY:
proc msg_topic {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_topic m $nick $uhost $handle [lindex $text 0] [lrange $text 1 end]
}
}
### MAIN:
proc all_topic {type nick uhost handle chan text} {
global set botnick
chan_settings topic $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 topic]} {
notice $nick $handle "Your level of [level $handle $chan] is less then the required [comget $chan topic] for this command"
} elseif {[level $handle $chan] < [changet $chan keeptopic]} {
notice $nick $handle "Your level of [level $handle $chan] is lower than the minimum level of [changet $chan keeptopic] required to change topics in $chan"
} else {
if {[lindex $text 0] == ""} {
set topic [readr $set(data.dir)/$set(topics.file)]
} else {
set topic $text
}
puthelp "TOPIC $chan :$topic"
chanset $chan topic $topic
putcmdlog "> !$handle! ($nick!$uhost) TOPIC\[$type\] ($chan): [charstrip $topic]"
}
}