-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8ball.etcl
executable file
·48 lines (44 loc) · 1.75 KB
/
8ball.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
###
# Usage: +8ball <question>
###
### 8BALL:
bind msg - 8ball "msg_error msg_8ball"
bind pub - $set(cmd)8ball "pub_error pub_8ball"
### CHANNEL:
proc pub_8ball {nick uhost handle chan text} {
if {[validuser $handle]} {
all_8ball c $nick $uhost $handle $chan $text
}
}
### QUERY:
proc msg_8ball {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_8ball m $nick $uhost $handle [lindex $text 0] [lrange $text 1 end]
}
}
### MAIN:
proc all_8ball {type nick uhost handle chan text} {
global set botnick
chan_settings 8ball $type $nick $uhost $handle $chan $text
if {[level $handle $chan] == "0" || ![auth_check $nick $uhost $handle $chan] || [backup_check $chan]} {
return
} elseif {[string tolower $type] != "c"} {
notice $nick $handle "Command '8ball' must be used as a channel command."
} 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 8ball]} {
notice $nick $handle "Your level of [level $handle $chan] is less then the required [comget $chan 8ball] for this command"
} elseif {![changet $chan funmsg]} {
notice $nick $handle "Fun messages are currently turned off in $chan"
} elseif {[lindex $text 0] == ""} {
notice $nick $handle "Invalid request: What question did you want to ask? :)"
} else {
msg $chan "\0028ball\002: $text?? [readr $set(data.dir)/$set(8ball.file)]"
}
}