Source code for bot.plugs.find

# bot/plugs/list.py
#
#

## IMPORTS


from bot.utils import error, time_string, to_time, time_stamp, do_objects, format_obj, short_date
from bot import kernel

## BASIC IMPORTS

import threading
import logging
import re

## find command 

[docs]def do_find(event): args = event.args if "timed" not in args: args.insert(0, "timed") else: args.extend(list(event.opts.keys())) done = [] objs = [] for obj in do_objects(event): value = None go = True for arg in event.args: try: value = getattr(obj, arg) except AttributeError: continue if not value: continue if go: objs.append(obj) for obj in sorted(objs, key=lambda x: x.timed): txt = "" for arg in event.args: try: txt += "%s -=- " % obj[arg] except KeyError: continue if not txt: continue txt = txt[:-5] event.reply(txt)
kernel.register("find", do_find)