Git Product home page Git Product logo

Comments (21)

qianyuxiang01 avatar qianyuxiang01 commented on May 28, 2024

屌屌的。py3有bug吗

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

@qianyuxiang 我简单的试用了一下没发现bug

from itchat.

pcloth avatar pcloth commented on May 28, 2024

报告一个BUG:
itchat.set_oplog(msg['FromUserName'],'测试用户ID')
设置备注名后,在用get_alias获取到的依然是昵称,不是备注名,需要重新运行机器人后才能拿到新的备注名

环境是py 3.5.1

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

@pcloth 收到

from itchat.

huangming avatar huangming commented on May 28, 2024

robot分支有计划能做python3分支么?我自己尝试了下好难改

from itchat.

chixinmu avatar chixinmu commented on May 28, 2024

我在Python3的环境下pip install itchat,但是提示没有一个thread模块,尝试安装thread也安装不了

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

@chixinmu 有更详细的报错吗?

from itchat.

chixinmu avatar chixinmu commented on May 28, 2024

image

from itchat.

chixinmu avatar chixinmu commented on May 28, 2024

windows 7 下,Python3.4.2 在cmd命令行下运行pip install itchat,出现No module named 'thread'的情况,我是新手,查到thread是多线程库,但是不知道为什么,在windows下没有安装

from itchat.

chixinmu avatar chixinmu commented on May 28, 2024

查到在Python3.4.2中,thread应为:_thread

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

@chixinmu 是我这里更新版本的问题,1.0.11版本的时候没有把py3的内容上传上去。
你现在尝试一下这个命令:

py -3 -m pip install itchat --no-cache-dir

from itchat.

chixinmu avatar chixinmu commented on May 28, 2024

@littlecodersh OK,已经安装完成了,谢谢!

from itchat.

liangshan avatar liangshan commented on May 28, 2024

在 py3 的版本里,移除了群聊中 msgisAt 属性,所以例子是跑不起来的。

  File "run.py", line 23, in text_reply
    if msg['isAt']:
KeyError: 'isAt'

我猜想,做 py3 的这位同学应该是觉得这个部分应该由 handler 自己决定吧。在 py2 的版本里,代码为

isAt = self.storageClass.nickName in Content

这里的判断个人感觉弱了点,至少把 @ 加进去变成

isAt = '@{}'.format(self.storageClass.nickName) in Content

还有如果群聊中发送的一段话如果带空格,会只取第一部分,这个有特别的原因吗?

if b'\342\200\205'.decode('utf8') in Content:
            Content = Content.split(b'\342\200\205'.decode('utf8'))[1]

顺便说一句为什么切换到 py3,因为 py2 下面例子里面群聊的发送者中文昵称是乱码,打印之后是类似下面的东西

 u'\xe4\xb8\x8d\xe6\x92\xa9'

这个字符串已经是 utf8 了,然而不知道哪个环节又给加上了 unicode 的标记。不过 py2 的字符集问题本来就很恼人。。。

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

@liangshan

  1. py3的例子当中并没有用到isAt属性:py3主页
  2. isAt属性没加是因为那是py3分支出去以后的更新
  3. 判断的确很弱,只是一个简单的试用。主要问题在与emoji的输入输出统一还没有做好。其实如果要加强也很简单,就在判断时跟上'\342\200\205'即可
  4. 那个取的是第二部分,因为现在只支持@robot content类型,具体原因也是emoji
  5. 这个不应该呀,client.py 129行在接收到消息时就进行了decode,给我看下你使用的程序吧,可能是我们这里出了点什么问题。

from itchat.

liangshan avatar liangshan commented on May 28, 2024

前面的问题大概都明白了,最后一个确实比较奇怪。整个返回值只有发送者昵称有问题,就是跑的项目首页例子。
安装是 pip 装的,然后自己复制了所有代码 直接命令行运行。找了个群让同事试了一下,发现自动回复的内容里面对方昵称是乱码,切换到py3 没有这个问题。

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

@liangshan 是特定的一个昵称有问题吗?如果是的话,方便给我一下完整的那个昵称吗?

from itchat.

liangshan avatar liangshan commented on May 28, 2024

不是特定的昵称,所有带汉字的都不行。运行的就是 master 也就是 python 2.7 的例子,具体版本号 应该是 python2.7.10

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

@liangshan 感谢你的报错,我这里已经复现了问题,会在下一个版本中更新到pypi。
问题出在requestsjson()方法上,把129行的内容更换为一下内容即可:

j = json.loads(self.s.post(url, data = json.dumps(payloads), headers = headers
        ).content.decode('utf8', 'replace'))['ContactList'][0]

from itchat.

Peteling avatar Peteling commented on May 28, 2024

能不能自定义自动回复的信息?

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

@Peteling 可以呀,return不同的内容或者调用itchat.send即可

from itchat.

littlecodersh avatar littlecodersh commented on May 28, 2024

由于python3版本已经并入主分支,该issue关闭

from itchat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.