Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msg['isAt'] BUG? #27

Closed
tylor-e opened this issue Jun 30, 2016 · 11 comments
Closed

msg['isAt'] BUG? #27

tylor-e opened this issue Jun 30, 2016 · 11 comments
Labels

Comments

@tylor-e
Copy link

tylor-e commented Jun 30, 2016

用了给的默认代码测试:

@itchat.msg_register('Text', isGroupChat = True)
def text_reply(msg):
if msg['isAt']:
itchat.send(u'@%s\u2005I received: %s'%(msg['ActualNickName'], msg['Content']), msg['FromUserName'])

字面意思我理解的是当@本人的时候方才回复。实际用的时候不管有无@均报错

Traceback (most recent call last):
File "D:\Py35\itchat\app.py", line 34, in
itchat.run()
File "E:\Python\Python27\Lib\site-packages\itchat-1.0.8-py2.7.egg\itchat__init__.py", line 167, in run
File "E:\Python\Python27\Lib\site-packages\itchat-1.0.8-py2.7.egg\itchat__init__.py", line 135, in configured_reply
File "D:\Py35\itchat\app.py", line 30, in text_reply
if msg['isAt']:
KeyError: 'isAt'

运行环境,windows10/python3.5.2

@tylor-e
Copy link
Author

tylor-e commented Jun 30, 2016

好像发到py2.7版本里来了。。。不好意思我去3.5那边发

@tylor-e tylor-e closed this as completed Jun 30, 2016
@littlecodersh
Copy link
Owner

@tylor-e 因为这是2.7这里的新功能,3.5还没更新

@littlecodersh
Copy link
Owner

@tylor-e 另外,开issue报bug无所谓的,2.7 3.5都可以直接开

@tylor-e
Copy link
Author

tylor-e commented Jun 30, 2016

@littlecodersh 嗯,我发现开issue也在一起。求更新或者简单的添加方法,我用Unirx的也写过这个功能,自己写满麻烦的,如果你的库集成了就最好啦~
另外报一个错,python3.5 用pip install itchat无法安装,最后我在这里下了源代码,setup.py install之后出现的奇怪的现象,在py2.7的目录下出现了新文件:E:\Python\Python27\Lib\site-packages\itchat-1.0.8-py2.7.egg,这也是上面的报错文件路径显示是2.7的原因

@tylor-e tylor-e reopened this Jun 30, 2016
@littlecodersh
Copy link
Owner

@tylor-e 试试这个命令:

pip install itchat --no-cache-dir

@tylor-e
Copy link
Author

tylor-e commented Jun 30, 2016

搞定isAt的功能啦,对比了一下两个版本的文件,在client.py里加入了相关的参数,这个功能就加好了

@littlecodersh
Copy link
Owner

@tylor-e 哈哈,好的

@tylor-e
Copy link
Author

tylor-e commented Jun 30, 2016

我不是专业程序员,就懂点皮毛,所以你告诉了我有差别我就去找差别,幸运的是不复杂所以就找到啦~
顺便问一个,我想在自己的脚本里提取自己的NickName和ID如何调用呢?我看你是存在Storage里面,但我不知道如何调用 @littlecodersh

@littlecodersh
Copy link
Owner

@tylor-e 厉害的!
你试试看这两个:

itchat.__client.storageClass.nickName
itchat.__client.storageClass.userName

@tylor-e
Copy link
Author

tylor-e commented Jun 30, 2016

@littlecodersh 真的非常感谢你们这些有想法又能干的程序员,这样专业的模块我是弄不了,但是拿来用用真的顺手,还能让我做更多的事

@littlecodersh
Copy link
Owner

@tylor-e 不客气的,能用到就好:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants