我对Python很新,我正在写一个脚本,当有人向你发送消息时发送Skype消息(并且它根据进程是否存在而改变消息。)我正在努力让python识别收到的消息。我已经看到了另一篇文章,但我很难将其纳入if语句。 如果需要,代码包含在下面。
import Skype4Py
import sys
import os
while 0 == 0: #infinite loop
if """user sends message to me""":
if #process is open (Still haven't figured this out, either!)
print("Process Found")
client = Skype4Py.Skype()
client.Attach()
user = ChatMessage.Sender #may need changing
message = 'SERVER ONLINE'
client.SendMessage(user, message)
print("Message sent to", ChatMessage.Sender)
else:
print("Process Non-Existant")
client = Skype4Py.Skype()
client.Attach()
user = ChatMessage.Sender #same as above
message = 'SERVER OFFLINE'
client.SendMessage(user, message)
print("Message sent to", ChatMessage.Sender)
else:
print("Awaiting Message")
else:
print("Physics is broken.")
这是我有多远。 谢谢 - James Whybrow