-
Notifications
You must be signed in to change notification settings - Fork 0
/
axeircbot.tcl
executable file
·63 lines (54 loc) · 1.89 KB
/
axeircbot.tcl
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
set axeircbot_version "1.1.0"
set axeircbot_script [file tail [ dict get [ info frame [ info frame ] ] file ]]
set axeircbot_command_en ""
set axeircbot_command_fr ""
putlog "$::axeircbot_script v$::axeircbot_version (by elberethzone) loading..."
set putlogloaded "$::axeircbot_script v$::axeircbot_version (by elberethzone) loaded!"
set axeircbot_commandlist_en ""
set axeircbot_commandlist_fr ""
proc axeircbot_command_cmp {a b} {
return [string compare [lindex $a 0] [lindex $b 0]]
}
# Load sub-scripts
set subfiles [glob -dir "$::axeircbot_dir" axeircbot.*.tcl]
putlog "== Found [llength $subfiles] sub-scripts to load:"
foreach subfile $subfiles {
source $subfile
}
# Sort commands
set axeircbot_command_en [lsort -command axeircbot_command_cmp $axeircbot_command_en]
set axeircbot_command_fr [lsort -command axeircbot_command_cmp $axeircbot_command_fr]
# Prepare the command list for !help display
set idxn 0
set totnen [llength $axeircbot_command_en]
set totn [expr $totnen-1]
foreach line $axeircbot_command_en {
set command [lindex $line 0]
set desc [lindex $line 1]
if { $desc == "" } {
set axeircbot_commandlist_en "$axeircbot_commandlist_en\( $command )"
} else {
set axeircbot_commandlist_en "$axeircbot_commandlist_en\( $command - $desc )"
}
if { $idxn < $totn } {
set axeircbot_commandlist_en "$axeircbot_commandlist_en|"
}
incr idxn
}
set idxn 0
set totnfr [llength $axeircbot_command_fr]
set totn [expr $totnen-1]
foreach line $axeircbot_command_fr {
set command [lindex $line 0]
set desc [lindex $line 1]
if { $desc == "" } {
set axeircbot_commandlist_fr "$axeircbot_commandlist_fr\( $command )"
} else {
set axeircbot_commandlist_fr "$axeircbot_commandlist_fr\( $command - $desc )"
}
if { $idxn < $totn } {
set axeircbot_commandlist_fr "$axeircbot_commandlist_fr|"
}
incr idxn
}
putlog "$putlogloaded (EN/FR $totnen/$totnfr commands registered)"