How can i creat addaccomand , list , remove commands? please help me Thank you
bind pub - !command pub:command
bind pub w !addcommand pub:addcommand
proc pub:addcommand { nick uhost handle channel arg } {
if { $arg == "" } {
putserv "NOTICE $nick :USAGE: !addcommand <command>"
return 0
}
set command [open "command.txt" a]
puts $command "$arg"
close $command
putserv "NOTICE $nick :Command Added"
}
proc pub:command { nick uhost handle channel arg } {
set commandfile [open "command.txt" r]
set i 0
while { [eof $commandfile] != 1 } {
incr i 1
set command($i) [gets $commandfile]
}
set w [rand $i]
set outcommand $command($w)
putserv "PRIVMSG $channel :$outcommand"
}