Exemplo n.º 1
0
def search(mute_last):
    if mute_last == "":
        last = 3 * 60
    elif mute_last.endswith("小时"):
        pattern = r"(\d+)"
        match = re.match(pattern, mute_last).group(0)
        last = int(match) * 60

    xconfig.MUTE_END_TIME = time.time() + last * 60
    result = xutils.SearchResult()
    result.name = "命令 - 静音"
    result.raw  = "静音到 %s" % xutils.format_time(xconfig.MUTE_END_TIME)
    return [result]
Exemplo n.º 2
0
def search(name):
    if not xauth.is_admin():
        return None
    results = []
    for fname in xutils.listdir(xconfig.SCRIPTS_DIR):
        if name in fname:
            result = xutils.SearchResult()
            result.name = xutils.u("脚本 - ") + fname
            result.raw = xutils.u("搜索到可执行脚本 - ") + fname
            result.url = xutils.u(
                "/system/script_admin?op=edit&name=%s") % fname
            result.command = xutils.u(
                "/system/script_admin/execute?name=%s") % fname
            results.append(result)
    return results
Exemplo n.º 3
0
def search_scripts(name):
    results = []
    for fname in xutils.listdir(xconfig.SCRIPTS_DIR):
        fpath = os.path.join(xconfig.SCRIPTS_DIR, fname)
        if not os.path.isfile(fpath):
            continue
        if fname.endswith(".zip"):
            continue
        if name in fname:
            result         = xutils.SearchResult()
            result.name    = xutils.u("脚本 - ") + fname
            result.raw     = xutils.u("搜索到可执行脚本 - ") + fname
            result.url     = xutils.u("/code/edit?path=%s") % fpath
            result.command = xutils.u("/system/script_admin/execute?name=%s") % fname
            results.append(result)
    return results
Exemplo n.º 4
0
def cancel():
    xconfig.MUTE_END_TIME = None
    result = xutils.SearchResult()
    result.name = "命令 - 取消静音"
    result.raw  = "已经取消静音"
    return [result]