所以,我正在为我的小组制作自己的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!
"""
答案 0 :(得分:2)
使用
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
为我工作!