Exemplo n.º 1
0
def fnd(event):
    if not event.args:
        fls = listfiles(obj.wd)
        if fls:
            event.reply(",".join([x.split(".")[-1].lower() for x in fls]))
        return
    name = event.args[0]
    nr = -1
    args = list(event.gets)
    try:
        args.extend(event.args[1:])
    except IndexError:
        pass
    got = False
    otypes = Kernel.getnames(name, [])
    for t in otypes:
        print(t)
        for fn, o in find(t, event.gets, event.index, event.timed):
            nr += 1
            txt = "%s %s" % (str(nr),
                             fmt(o, args or o.keys(), skip=event.skip.keys()))
            if "t" in event.opts:
                txt = txt + " %s" % (elapsed(time.time() - fntime(fn)))
            got = True
            event.reply(txt)
    if not got:
        event.reply("no result")
Exemplo n.º 2
0
def fnd(event):
    if not event.args:
        fls = listfiles(cfg.wd)
        if fls:
            event.reply("|".join([x.split(".")[-1].lower() for x in fls]))
        return
    name = event.args[0]
    t = Names.getnames(name)
    nr = -1
    args = list(event.gets)
    try:
        args.extend(event.args[1:])
    except IndexError:
        pass
    got = False
    for otype in t:
        for fn, o in find(otype, event.gets, event.index, event.timed):
            nr += 1
            txt = "%s %s" % (str(nr), fmt(o, args or o.keys(), skip=event.skip.keys()))
            if opts("t") or "t" in event.opts:
                if "Date" in o.keys():
                    fn = os.sep.join(todate(o.Date).split())
                txt = txt + " %s" % (elapsed(time.time() - fntime(fn)))
            got = True
            event.reply(txt)
    if not got:
        event.reply("no result")
Exemplo n.º 3
0
def krn(event):
    if not event.args:
        event.reply(fmt(Kernel.cfg, skip=["otxt", "opts", "sets", "old", "res"]))
        return
    edit(Kernel.cfg, event.sets)
    Kernel.cfg.save()
    event.reply("ok")
Exemplo n.º 4
0
def flt(event):
    try:
        index = int(event.args[0])
        event.reply(fmt(Bus.objs[index], skip=["queue", "ready", "iqueue"]))
        return
    except (TypeError, IndexError):
        pass
    event.reply(" | ".join([getname(o) for o in Bus.objs]))
Exemplo n.º 5
0
def cfg(event):
    c = Cfg()
    last(c)
    if not event.sets:
        return event.reply(fmt(c, skip=["username", "realname"]))
    edit(c, event.sets)
    c.save()
    event.reply("ok")