def scan(context): name = context.get("name") body = context.get("body") if body in get_setting("SUS_MARKERS"): tmp = get_response_context(context) tmp["body"] = translate_sus(name) send_message(tmp)
def scan(context): global timeout name = context.get("name") body = context.get("body") if body in get_setting("GREET_MARKERS"): if timeout < time.time(): timeout = time.time() + get_setting("GREET_TIMEOUT") else: return tmp = get_response_context(context) tmp["body"] = translate_sus(name) send_message(tmp)
def scan_imgur_links(context): match = urlRegex.search(context.get("body")) if match: id = match.groups()[0] if id in history: return else: history.append(id) info = get_image_info("http://imgur.com/" + id) if len(info.title) > 0 and info.title != "imgur: the simple image sharer": context = get_response_context(context) context["body"] = info.title send_message(context)
def reply(context, body): context = get_response_context(context) context["body"] = body send_message(context)
def __init__(self, context): self.context = get_response_context(context)