1

所以,我正在为我的小组制作自己的 Skype 机器人,但我不知道如何为我的生活检索最新消息。我很快就查阅了互联网和 stackoverflow,因为我经常处理一些小问题,但是 Skype4Py 文档中几乎不存在特定功能的文档,而 stackoverflow 上也没有。这是我的代码,请帮忙?

#Importing!
import time, sys
import Skype4Py

#Set skypeclient and connect, while also setting my desired user
skypeClient = Skype4Py.Skype()
skypeClient.Attach()
user = sys.argv[1]

#Loop!
while 1:
    """
    Here I am stumped. I have tried skypeClient.Chat.GetRecentMessages(),
    skypeClient.Chat.Chat.GetRecentMessages
    and that wouldn't even work for my purposes if it did work!
    """
4

1 回答 1

1

使用

def Commands(Message, Status):
    if Status == 'SENT' or (Status == 'RECEIVED'):
        running = 1
        message = Message.Body.lower()
        handle = Message.FromHandle.upper()
        if running == 1:
            if message == 'WHATEVER':

那么后来,

skype = Skype4Py.Skype()
skype.OnMessageStatus = Commands
skype.Attach()
while True:
    pass

为我工作!

于 2014-12-17T03:03:59.323 回答