Искам да направя така че като се скипне въпр със !skip да отнема 2 точки на този който е написал командата
ето го самият скрипт(tcl)
нещо немога да разбера как става
ето го самият скрипт(tcl)
нещо немога да разбера как става
}
proc pub_parsecmd {nick uhost hand chan text} {
global pub_setting version uptime botnick
set needauth 0
set authed 0
if {[matchattr $hand +Q]} { set authed 1 }
foreach i [channel info $chan] {
if {([string match "+auth" $i]) || ($pub_setting(allauth))} {
set needauth 1
break
}
}
if {!$needauth} { set authed 1 }
if {![matchattr $hand D]} {
set usesubop 0
foreach i [channel info $chan] {
if {[string match "+subop" $i]} {
set usesubop 1
break
}
}
set botuptime [duration [expr [unixtime] - $uptime]]
set extxt [split $text]
regsub -all -- "\\\]" "$text" "" text
regsub -all -- "\\\[" "$text" "" text
regsub -all -- "\}" "$text" "" text
regsub -all -- "\{" "$text" "" text
regsub -all -- "\"" "$text" "" text
set cmd [string tolower [lindex [split $text] 0]]
set commandlist {
access
gethand
invite
die
chattr
randpass
-chan
+chan
raw
restart
disable
enable
rehash
jump
hosts
uptime
chanlist
+host
-host
global
cycle
subop
aop
master
owner
autovoice
wipe
act
say
akick
msg
save
mode
voice
devoice
op
deop
deopme
opme
voiceme
devoiceme
kick
fuck
ban
unban
topic
help
version
}
if {$authed} {
switch -- $cmd {
"access" {
if {[lindex $extxt 1] == ""} {
set user $nick
} else {
set user [lindex $extxt 1]
}
if {![onchan $user $chan]} {
pub_putmsg $chan "$user is not on $chan."
} else {
pub_putmsg $chan "[pub_getaccess $user $chan]"
}
}
"gethand" {
if {[lindex $extxt 1] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) GetHand <nick>"
} elseif {![onchan [lindex $extxt 1] $chan]} {
pub_putmsg $chan "[lindex $extxt 1] is not on $chan."
} elseif {[lindex $extxt 1] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) GetHand <nick>"
} elseif {![validuser [nick2hand [lindex $extxt 1]]]} {
pub_putmsg $chan "[lindex $extxt 1] is not a bot user."
} else {
pub_putmsg $chan "[lindex $extxt 1]'s handle is [nick2hand [lindex $extxt 1]]."
}
}
"invite" {
if {[lindex $extxt 1] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) Invite \[nick\] <channel>"
} elseif {[lindex $extxt 2] != ""} {
if {(![validchan [lindex $extxt 2]]) || (![botonchan [lindex $extxt 2]])} {
pub_putmsg $chan "I am not on [lindex $extxt 2]."
} else {
putserv "invite [lindex $extxt 1] [lindex $extxt 2]"
pub_putmsg $chan "[lindex $extxt 1] has been invited to [lindex $extxt 2]."
}
} elseif {(![validchan [lindex $extxt 1]]) || (![botonchan [lindex $extxt 1]])} {
pub_putmsg $chan "I am not on [lindex $extxt 1]."
} elseif {([matchattr $hand o|o [lindex $extxt 1]]) && (![matchattr $hand d|d [lindex $extxt 1]])} {
putserv "invite $nick [lindex $extxt 1]"
} elseif {$pub_setting(noticeacc)} {
putserv "NOTICE $nick :This command requires Channel Op access to $chan."
}
}
"die" {
if {$pub_setting(enable-die)} {
if {![matchattr $hand n]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Owner access." }
} elseif {$pub_setting(1.6.7)} {
die "[lrange $extxt 1 end] \($hand\)"
} else {
putserv "QUIT :[lrange $extxt 1 end] \($hand\)"
utimer 3 "pub_dokill $hand [lrange $extxt 1 end]"
}
}
}
"chattr" {
if {![matchattr $hand n]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Owner access." }
} elseif {[lindex $extxt 2] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) Chattr <nick> <flags> \[channel\]"
} elseif {![validuser [nick2hand [lindex $extxt 1]]]} {
pub_putmsg $chan "[lindex $extxt 1] is not a bot user."
} else {
if {[lindex $extxt 3] == ""} {
pub_putmsg $chan "Global flags for [lindex $extxt 1] are now [chattr [lindex $extxt 1] [lindex [split $text] 2]]."
} elseif {[validchan [lindex $extxt 3]]} {
pub_putmsg $chan "Channel flags for [lindex $extxt 1] on [lindex $extxt 3] are now [lindex [split [chattr [lindex $extxt 1] [lindex [split $text] 2] [lindex $extxt 3]] |] 1]."
} else {
}
}
"restart" {
if {![matchattr $hand n]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Owner access." }
} else {
putquick "PRIVMSG $chan :Restarting."
restart
}
}
"disable" {
if {![matchattr $hand n]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Owner access." }
} elseif {[lindex $extxt 1] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) Disable <nick>"
} elseif {![validuser [nick2hand [lindex $extxt 1]]]} {
pub_putmsg $chan "No handle found for [lindex $extxt 1]."
} elseif {[matchattr [nick2hand [lindex $extxt 1]] D]} {
pub_putmsg $chan "[nick2hand [lindex $extxt 1]] is already disabled."
} else {
chattr [nick2hand [lindex $extxt 1]] +D
pub_putmsg $chan "[nick2hand [lindex $extxt 1]] has been disabled."
}
}
"enable" {
if {![matchattr $hand n]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Owner access." }
} elseif {[lindex $extxt 1] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) Enable <nick>"
} elseif {![validuser [nick2hand [lindex $extxt 1]]]} {
pub_putmsg $chan "No handle found for [lindex $extxt 1]."
} elseif {![matchattr [nick2hand [lindex $extxt 1]] D]} {
pub_putmsg $chan "[nick2hand [lindex $extxt 1]] is already enabled."
} else {
chattr [nick2hand [lindex $extxt 1]] -D
pub_putmsg $chan "[nick2hand [lindex $extxt 1]] has been enabled."
}
}
"rehash" {
if {![matchattr $hand m]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Master access." }
} else {
putquick "PRIVMSG $chan :Rehashing."
rehash
}
}
"jump" {
if {![matchattr $hand n]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Master access." }
} elseif {[lindex $extxt 1] != ""} {
jump [lindex [split $text] 1]
} else {
jump
}
}
"hosts" {
if {![matchattr $hand m]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Master access." }
} elseif {[lindex $extxt 1] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) Hosts <nick>"
} elseif {![validuser [nick2hand [lindex $extxt 1]]]} {
pub_putmsg $chan "[lindex $extxt 1] is not a bot user."
} else {
set h [join [getuser [nick2hand [lindex $extxt 1]] HOSTS]]
if {$h == ""} {
pub_putmsg $chan "[lindex $extxt 1] has no hosts set."
} else {
pub_putmsg $chan "$h"
}
}
}
"uptime" {
if {![matchattr $hand m]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Master access." }
} else {
pub_putmsg $chan "Uptime: $botuptime"
}
}
"chanlist" {
if {![matchattr $hand m]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Master access." }
} else {
pub_putmsg $chan "Channel list: [channels]"
}
}
"version" {
if {![matchattr $hand m]} {
pub_putmsg $chan "Version: $pub_setting(hversion)"
} else {
pub_putmsg $chan "Version: $pub_setting(version)"
}
}
"+host" {
if {![matchattr $hand m]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Master access." }
} elseif {[lindex $extxt 2] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) +host <nick> <host>"
} elseif {![validuser [lindex $extxt 1]]} {
pub_putmsg $chan "[lindex $extxt 1] is not a bot user."
} else {
pub_putmsg $chan "[lindex $extxt 2] has been added to [lindex $extxt 1]'s host list."
setuser [lindex $extxt 1] HOSTS [lindex $extxt 2]
}
}
"-host" {
if {![matchattr $hand m]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Master access." }
} elseif {[lindex $extxt 2] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) -host <nick> <host>"
} elseif {![validuser [lindex $extxt 1]]} {
pub_putmsg $chan "[lindex $extxt 1] is not a bot user."
} else {
set hd 0
foreach h [join [getuser [nick2hand [lindex $extxt 1]] HOSTS]] {
if {[string equal -nocase [lindex $extxt 2] $h]} {
delhost [nick2hand [lindex $extxt 1]] $h
pub_putmsg $chan "[lindex $extxt 2] has been removed from [lindex $extxt 1]'s host list."
set hd 1
}
}
if {!$hd} { pub_putmsg $chan "[lindex $extxt 2] does not exist on [lindex $extxt 1]'s host list." }
}
}
"global" {
if {![matchattr $hand m]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Global Master access." }
} elseif {[lindex $extxt 1] == ""} {
puthelp "NOTICE $nick :Usage: $pub_setting(prefix) Global <message>"
} else {
foreach c [channels] {
if {[botonchan $c]} { pub_putmsg $c "Global: [join [lrange $extxt 1 end]] \($nick\)" }
}
}
}
"cycle" {
if {![matchattr $hand m|m]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Channel Master access." }
} else {
putserv "PART $chan :Cycle \($nick\)"
}
}
"subop" {
if {![matchattr $hand o|o]} {
if {$pub_setting(noticeacc)} { putserv "NOTICE $nick :This command requires Channel Master access." }
} elseif {!$usesubop} {
pub_putmsg $chan "SubOp i