itchat 把个人的微信号,打造成机器人
程序员文章站
2024-02-11 14:56:34
...
#!/usr/bin/python
#coding=utf-8
import requests, json
import itchat
import conf
from itchat.content import *
def rev(_info):
api_url = conf.apiurl
mydata = {
'key':conf.my_key
'info':_info
}
r = requests.post(api_url,data=mydata).json()
return r
@itchat.msg_register([TEXT])
def text_reply(msg):
m = rev(msg['Content'])
itchat.send(m['text'], msg['FromUserName'])
if m['code'] == 200000:
itchat.send(m['url'], msg['FromUserName'])
if m['code'] == 302000:
itchat.send(m['list'], msg['FromUserName'])
if m['code'] == 308000:
itchat.send(m['list'], msg['FromUserName'])
itchat.auto_login()
itchat.run()
上一篇: 检查USB是否连接