コード例 #1
0
ファイル: topic.py プロジェクト: Yoplitein/gadget
def send_to_destination(addr, body):
    context = {
        "protocol": Globals.protocols.get(addr.protocol),
        "destination": {addr.protocol: [addr]},
        "body": body,
        "isFormatted": True,
    }
    
    send_message(context)
コード例 #2
0
ファイル: greet.py プロジェクト: 4rChon/gadget
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)
コード例 #3
0
ファイル: greet.py プロジェクト: Yoplitein/gadget
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)
コード例 #4
0
ファイル: imgur.py プロジェクト: Yoplitein/gadget
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)
コード例 #5
0
ファイル: interaction.py プロジェクト: Yoplitein/gadget
def reply(context, body):
    context = get_response_context(context)
    context["body"] = body
    
    send_message(context)
コード例 #6
0
ファイル: commands.py プロジェクト: Yoplitein/gadget
 def send_message(self, msg):
     self.context.update({"body": msg})
     send_message(self.context)