You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python-project/api/itca/itch.py

22 lines
517 B

3 years ago
import itchat
from bot import test
from datetime import datetime
now = str(datetime.now())
@itchat.msg_register(itchat.content.TEXT)
def text_reply(msg):
with open('wechat.log','a',encoding='utf-8') as f:
fromuser = msg.FromUserName
touser = msg.ToUserName
text = msg.Text
f.write(now+'\n')
f.write(fromuser+'\n')
f.write(text+'\n')
f.write('\n')
r = test(text)
itchat.send(r, toUserName=fromuser)
itchat.auto_login( hotReload=True)
itchat.run()