Thread: alias
View Single Post
Old 12-07-2005, 22:08   #4 (permalink)
lsn
Member
 
lsn's Avatar
 
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 38
lsn will become famous soon enough
Default

Code:
a:command -add alias	 pub:alias			 1132 626 |N

proc pub:alias {hand chan args x mix} {
	
	set comm [lindex $args 0]
	set aka  [lindex $args 1]
	
	if {![string length $comm]}		 { usage $x alias; return "FAILED: not all paramatres specified"}
	if { [regexp {^(-remove|-r)$} $comm] && $aka!=""} {if {[string equal -nocase all $aka]} {alias -clean $chan; tell $x 346 ; return "removed all"} {if {![alias -exists $chan $aka]} {tell $x 343 $aka; return "no such alias ($aka)"} {tell $x 344 $aka; alias -remove $chan $aka; return "removed $aka"}}}
	if { [regexp {^(-list|-l)$} $comm]} {set list [alias -list $chan]; if {![llength $list]} {tell $x 348 $chan; return "failed empty"} {tell $x 17 $list; return $list}}
	if {![a:command -exists $comm]}	 {tell $x 18 $comm; return "FAILED: invalid command specified ($comm)"}
	if {![string length $aka]}		 { usage $x alias; return "FAILED: not all paramatres specified"}
	if { [command -exists $aka] || [alias -exists $chan $aka]} {tell $x 283 $aka; return "failed already exists a command name/alias $aka"}
	if { [alias -number $chan] >= 15}   {tell $x 347; return "failed already have 15 aliases"}
	
	alias -add $chan $comm $aka
	
	tell $x 345 "$aka $comm"
	
	return "$comm" 
}
Code:
set say(lang.1.283)   "FAILED: there is already a command with name/alias «."
set say(lang.1.343)   "FAILED: i have no info about %B«%B alias ..."
set say(lang.1.344)   "Removed %B«%B alias ..."
set say(lang.1.345)   "Added %r«%% as alias for command %b«%%."
set say(lang.1.347)   "FAILED: You can only set 15 aliases."
set say(lang.1.346)   "Removed all aliases."
set say(lang.1.348)   "FAILED: No alias defined for « channel."
set say(lang.1.626)   "USAGE: «alias \[-remove|-list\] <command> <alias> \[all\] «"
set say(lang.1.1132)  "HELP: Define any ALIAS to any BOT command (you can specify up to 15 aliases per chan)"
in proc a:parser modifici
Code:
if { [string match "#*" $option]} {set args [lrange $arg 1 end]; set chan $option} { set args $arg}
if {![a:command -exists $comm]} {return} elseif { [a:command -inactive $comm $chan]} {return}
in

Code:
if { [string match "#*" $option]} {set args [lrange $arg 1 end]; set chan $option} { set args $arg}
set comm [alias -check $chan $comm]
if {![a:command -exists $comm]} {return} elseif { [a:command -inactive $comm $chan]} {return}
si ca sa iti salveze aliasurile in a&a_40_a_stats.tcl

cauti
Code:
puts $file "\n#Disabled local & global commands\n"
puts $file "[a:command -array]"
si modifici in
Code:
puts $file "\n#Disabled local & global commands\n"
puts $file "[a:command -array]"

puts $file "\n#Aliases for commands\n"
        puts $file "[alias -array]"
cam asta ar fi tot sper ca nu am uitat nimic :p
lsn is offline   Reply With Quote