import itchat标签:itchat,python,os,电脑,wechat,result,res,command,filehelper From: https://blog.51cto.com/u_15883840/5871388
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()