Exemple #1
0
 def handle(self,handlerChain):
     
     logging.debug(handlerChain.userMsg.get("MsgType"))
     
     if(handlerChain.getMsgType()!="text"):
         return None#if you cant handle this msg ,just return None or return handlerChain.invokeNext()
     if keyWordDict.has_key(handlerChain.getMsgContent()):
         return Weixin.textReply(handlerChain.userMsg,keyWordDict.get(handlerChain.getMsgContent()) + helpmsg)
     answer = random.randint(0,len(sellMoeList)-1)
     return Weixin.textReply(handlerChain.userMsg,sellMoeList[answer]+helpmsg)
 def handle(self,handlerChain):
     
     if (handlerChain.getMsgType()==Weixin.__MSGTYPE_EVENT__):
         if(handlerChain.getFromMsg("Event")==NewPageHandler.__event_key__):
             return Weixin.textReply(handlerChain.userMsg,"")
     
     return handlerChain.invokeNext()    
Exemple #3
0
    def handle(self, handlerChain):

        if (handlerChain.getMsgType() == Weixin.__MSGTYPE_EVENT__):
            if (handlerChain.getFromMsg("Event") == __event_key__):
                return Weixin.textReply(handlerChain.userMsg, "")

        return handlerChain.invokeNext()
    def handle(self, handlerChain):

        if handlerChain.getMsgType() == Weixin.__MSGTYPE_EVENT__:
            if handlerChain.getFromMsg("Event") == __event_subscribe__:
                logging.debug("new user!")
                return Weixin.textReply(handlerChain.userMsg, "从今天开始要好好相处哦!")

        return handlerChain.invokeNext()
 def handle(self,handlerChain):
     
     if (handlerChain.getMsgType()==Weixin.__MSGTYPE_EVENT__):
         if(handlerChain.getFromMsg("Event")==__event_subscribe__):
             logging.debug("new user!")
             return Weixin.textReply(handlerChain.userMsg,"")
     
     return handlerChain.invokeNext()
 def handle(self,handlerChain):
     
     if (handlerChain.getMsgType()=="text"):
         content = handlerChain.getMsgContent()
         if hasKeyWord(content):
             searchKey = content[:content.rfind(__suf__)]
             resultList = MoeGirlWiki.searchTitle(searchKey)
             return Weixin.textReply(handlerChain.userMsg,buildReplyStr(resultList))
     return handlerChain.invokeNext()
Exemple #7
0
    def handle(self, handlerChain):

        if (handlerChain.getMsgType() == "text"):
            content = handlerChain.getMsgContent()
            if hasKeyWord(content):
                searchKey = content[:content.rfind(__suf__)]
                resultList = MoeGirlWiki.searchTitle(searchKey)
                return Weixin.textReply(handlerChain.userMsg,
                                        buildReplyStr(resultList))
        return handlerChain.invokeNext()
 def handle(self,handlerChain):
     
     if (handlerChain.getMsgType()=="text"):
         content = handlerChain.getMsgContent()
         if (content.endswith(__flower_key__) or content.startswith(__flower_key__)):
             flowerName = content.replace(__flower_key__, "")
             if flowerName!="":
                 return Weixin.textReply(handlerChain.userMsg,findFlower(flowerName))
     
     return handlerChain.invokeNext()
Exemple #9
0
    def handle(self, handlerChain):

        if (handlerChain.getMsgType() == "text"):
            content = handlerChain.getMsgContent()
            if (content.endswith(__flower_key__)
                    or content.startswith(__flower_key__)):
                flowerName = content.replace(__flower_key__, "")
                if flowerName != "":
                    return Weixin.textReply(handlerChain.userMsg,
                                            findFlower(flowerName))

        return handlerChain.invokeNext()
 def handle(self,handlerChain):
     
     if (handlerChain.getMsgType()=="text"):
         content = handlerChain.getMsgContent()
         if content.startswith(__help_key__):
             result = ""
             if content == __help_key__:
                 logging.debug("view help")
                 result = __help_content__
             else:
                 key = content.replace(__help_key__, "")
                 if key in __help_dict__:
                     result = __help_dict__[key]
                 else : return handlerChain.invokeNext()#if there is no such help
             return Weixin.textReply(handlerChain.userMsg,result);  
         
     return handlerChain.invokeNext()