コード例 #1
0
ファイル: botclient.py プロジェクト: beandon/Skypebot
def simpleHandler(msg, event):
    """SimpleHandler: Used to handle incoming messages. When a
    message is received via skype, this method is executed"""

    if event == u"RECEIVED":
        logger.debug("Received Message - {0}: {1}".format(msg.FromDisplayName, msg.Body))
        if msg.Body.lower() == "bucket, remember that":
            rememberHandler(msg)
        elif msg.Body.lower() == "bucket, forget that":
            forgetHandler(msg)
        elif msg.Body.lower() == "bucket, what was that":
            whatHandler(msg)
        elif msg.Body.lower().startswith("bucket, add"):
            addHandler(msg)
        elif msg.Body.lower().startswith("bucket, rss"):
            rssHandler(msg)
        elif msg.Body.lower().startswith("bucket, inv"):  # INVENTORY
            inventoryHandler(msg)
        elif msg.Body.lower().startswith("bucket, video"):
            randomVideoHandler(msg)
        elif "http://www.youtube.com/" in msg.Body.lower() or "http://youtu.be/" in msg.Body.lower():
            videoURLHandler(msg)
        elif re.search(r"^[A-Z]{3}\??$", msg.Body):
            tlaHandler(msg);
        elif "gives bucket" in msg.Body.lower():
            itemHandler(msg)
        elif isBandName(msg.Body):
            msg.Chat.SendMessage("That would be a good name for a band")
        else: 
	    wasCommand = False
	    if msg.Body.startswith("bucket, "):
		wasCommand = arbitraryCommandHandler(msg)
   	    if not wasCommand:
		if msg.FromDisplayName != BOT_DISPLAY_NAME:
		    responseHandler(msg)
コード例 #2
0
ファイル: testclient.py プロジェクト: beandon/Skypebot
def simpleHandler(msg, event):
    """SimpleHandler: Used to handle incoming messages. When a
    message is received via skype, this method is executed"""

    if event == u"RECEIVED":
        if msg.Body == "bucket, remember that":
            rememberHandler(msg)
        elif msg.Body == "bucket, forget that":
            forgetHandler(msg)
        elif msg.Body == "bucket, what was that":
            whatHandler(msg)
        elif msg.Body.startswith("bucket, add"):
            addHandler(msg)
        elif msg.Body.startswith("bucket, rss"):
            rssHandler(msg)
        elif msg.Body.startswith("bucket, inventory"):
            inventoryHandler(msg)
        elif re.search(r"^[A-Z]{3}\??$", msg.Body):
            tlaHandler(msg);
        elif "gives bucket" in msg.Body:
            itemHandler(msg)
        elif isBandName(msg.Body):
            msg.Chat.SendMessage("That would be a good name for a band")
        else: 
	    wasCommand = False
	    if msg.Body.startswith("bucket, "):
		wasCommand = arbitraryCommandHandler(msg)
   	    if not wasCommand:
		if msg.FromDisplayName != BOT_DISPLAY_NAME:
		    responseHandler(msg)