Python Skype bot有时不发送消息

2024-09-28 20:55:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经开始编写一个Skype机器人作为我的第一个Python项目。当它实际发送消息时,它工作得很好,但有时它完全不发送消息。我不确定是因为我写得不好还是因为我的网络连接。在

botfuncs通常在my code中发送消息失败:

def botfuncs():
    def OnMessageStatus(Message, Status):
        if Status == 'RECEIVED':
            c = Message.Body
            if Message.Body.lower() == "time":
                client.SendMessage(Message.FromHandle, "The current time is {0}".format(time.strftime("%Y, %b %d, %H:%M:%S.")))
            elif c[0:4].lower() == "sudo":
                client.SendMessage(Message.FromHandle, c[5:])
    client.OnMessageStatus = OnMessageStatus

Tags: client消息messageiftimedefstatus机器人