python中wechat控制电脑

版权声明:皆为本人原创,复制必究 https://blog.csdn.net/m493096871/article/details/86607782
import itchat
import time
import random
import os

@itchat.msg_register(itchat.content.TEXT)
def text_reply(s):
    if s['ToUserName']=='filehelper':
        command=s['Content']
        print(command)

        if os.system(command)==0:
            res=os.popen(command).read()
            result='执行成功,结果\n'+res
            itchat.send(result,'filehelper')
        else:
            result='失败,重式%s'%command
            itchat.send(result,'filehelper')
itchat.auto_login()
itchat.run()

猜你喜欢

转载自blog.csdn.net/m493096871/article/details/86607782
今日推荐