-2
bind pub - "!find" pub:cari

proc pub:cari { nick host hand chan text } {
    set judul [lindex $text 0]
    if { $judul == ""} {
        puthelp "notice $nick :ketik !find <penyanyi/artis>"
        return
    } else {
        putquick "notice $nick :being processed $judul"
        catch [list exec find /home/gusman/mp3 -name "*$judul*" -type f -printf "%f\n"] data
        putserv "notice $nick :!putar $data"
        putserv "notice $nick :copy paste di channel !putar $data"
    }
}

putlog "find.tcl"

如果搜索在数据中,则可以很好地发布到目标。如果查到的数据是空的,则不起作用,请指出此脚本是否不完整或错误。

4

2 回答 2

0

我在这条线上有解决方案:

if { $judul == ""}
于 2018-03-21T22:05:34.880 回答
0

这样的事情有用吗?

    proc pub:cari { args } {
        lassign $args nick host hand chan text
        ...

通常在 TCL 中,如果你没有向函数传递足够的参数,那么你会得到一个错误。如果你不知道你的函数需要多少个参数,你可以将最后一个参数命名为“args”,任何额外的参数都将作为一个列表放入这个变量中。

于 2018-03-29T23:00:18.677 回答