Giter Site home page Giter Site logo

添加好友报错 about wxpy HOT 10 CLOSED

youfou avatar youfou commented on April 28, 2024
添加好友报错

from wxpy.

Comments (10)

youfou avatar youfou commented on April 28, 2024

你好,能否发一下 bot.accept_friend(msg.chat) 所在的注册函数以及注册条件?
我想确认下,会不会 msg.chat 在这个时候并非应被接受好友请求的对象。

from wxpy.

youfou avatar youfou commented on April 28, 2024

如果是想要接受好友请求,也可以参考这里
https://gist.github.com/youfou/03c1e0204ac092f873730f51671ce0a8#file-wxpy_group-py-L381

from wxpy.

frank201524 avatar frank201524 commented on April 28, 2024

你好 这个是我的代码
@bot.register()
def print_others(msg):
logging.info(msg)

if msg.type == "Note" and "刚刚把你添加到通讯录" in msg.text:
    logging.info("add new friend: " + msg.chat.nick_name)
    msg.chat.send_image('new_user.jpg')
    msg.chat.accept()
    return

我的微信机器人账号设置的加我好友时不需要验证,所以用户添加我到通讯录之后可以直接发消息给我,然后调用msg.chat.accept()时就报了错

谢谢啦~

from wxpy.

frank201524 avatar frank201524 commented on April 28, 2024

另外,就上面那堆代码msg.chat.send_image('new_user.jpg')也有报错的情况,报错内容如下
Tue, 02 May 2017 09:47:04 bot.py[line:330] ERROR
An error occurred in <function print_others at 0x7fccde9ca7b8>.
Traceback (most recent call last):
File "/opt/python35/lib/python3.5/site-packages/wxpy/api/bot.py", line 326, in process
ret = config.func(msg)
File "ttsbot-prod.py", line 35, in print_others
msg.chat.send_image('new_user.jpg')
File "/opt/python35/lib/python3.5/site-packages/wxpy/utils/misc.py", line 59, in wrapped
smart_map(check_response_body, ret)
File "/opt/python35/lib/python3.5/site-packages/wxpy/utils/misc.py", line 178, in smart_map
return func(i, *args, **kwargs)
File "/opt/python35/lib/python3.5/site-packages/wxpy/utils/misc.py", line 25, in check_response_body
raise ResponseError('ret: {}; err_msg: {}'.format(ret, err_msg))
wxpy.exceptions.ResponseError: ret: -1; err_msg:
麻烦了~

from wxpy.

frank201524 avatar frank201524 commented on April 28, 2024

不好意思,还有个编码问题,获取用户昵称的时候,✨Katherine是用户的昵称,到了wxpy里面就成了❇Katherine,这个怎么解决呢

from wxpy.

powersam avatar powersam commented on April 28, 2024

你好:
我在调用add_friend() 添加好友的时候 不成功
from wxpy import *
bot=Bot()
#wechatid是微信的ID号 手工能够添加
bot.add_friend('wechatid',verify_content='hello world')

报错如下:
raise ResponseError(dict(err_code=err_code, err_msg=err_msg))
wxpy.exceptions.ResponseError: {'err_msg': '', 'err_code': -1}

再群里问了下 说是有此数限制 我凌晨过了12点 和早上8点都试了一次 其他时间也试过好多次 都是报错。请问这个是怎么回事呢?

from wxpy.

youfou avatar youfou commented on April 28, 2024

@powersam 最近了解到,似乎Web微信开始屏蔽微信ID了,所以请使用wxpy的用户对象,或类似@1234567890abcdef... 的 user_name。

from wxpy.

youfou avatar youfou commented on April 28, 2024

@frank201524 这个编码的问题 wxpy 并没有特别处理呢,可以看看 wx.qq.com 中是不是也被转换了?

from wxpy.

makeapp007 avatar makeapp007 commented on April 28, 2024

@youfou 请问现在添加好友就什么好点的解决办法吗?如何使用wxpy对象来加好友,能否给个例子?

from wxpy.

3094830052 avatar 3094830052 commented on April 28, 2024

wxpy

user_name是对自己好友才有的,已经是好友了还加什么呢?现在能否说明一下添加好友这个接口到底可以用不(通过微信号,手机号什么的)

from wxpy.

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.