|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#coding=gbk
import itchat
import time
from itchat.content import TEXT
def lc():
print("登入成功!")
def ec():
print("exit")
itchat.auto_login(loginCallback=lc, exitCallback=ec)
@itchat.msg_register(TEXT) #这里的TEXT表示如果有人发送文本消息,那么就会调用下面的方法
def simple_reply(msg):
#这个是向发送者发送消息
itchat.send_msg('已经收到了文本消息,消息内容为%s'%msg['Text'],toUserName=msg['FromUserName'])
return "T reveived: %s" % msg["Text"] #返回的给对方的消息,msg["Text"]表示消息的内容
time.sleep(15)
itchat.logout()
运行代码以后,我一直用另外一个微信给自己发消息,窗口毫无动静,微信那边也没有收到回复。
我自己按照教程写了代码,收不到。
后来,我直接复制了别人的代码,依然收不到消息。
有人知道原因不?
下面是跑代码之后显示的内容。
Getting uuid of QR code.
Downloading QR code.
Please scan the QR code to log in.
Please press confirm on your phone.
Loading the contact, this may take a little while.
登入成功!
exit
|
|