Exemple #1
0
def send_to_destination(addr, body):
    context = {
        "protocol": Globals.protocols.get(addr.protocol),
        "destination": {addr.protocol: [addr]},
        "body": body,
        "isFormatted": True,
    }
    
    send_message(context)
Exemple #2
0
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)
Exemple #3
0
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)
Exemple #4
0
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)
Exemple #5
0
def reply(context, body):
    context = get_response_context(context)
    context["body"] = body
    
    send_message(context)
Exemple #6
0
 def send_message(self, msg):
     self.context.update({"body": msg})
     send_message(self.context)