Comments (10)
你好,能否发一下 bot.accept_friend(msg.chat)
所在的注册函数以及注册条件?
我想确认下,会不会 msg.chat
在这个时候并非应被接受好友请求的对象。
from wxpy.
如果是想要接受好友请求,也可以参考这里
https://gist.github.com/youfou/03c1e0204ac092f873730f51671ce0a8#file-wxpy_group-py-L381
from wxpy.
你好 这个是我的代码
@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.
另外,就上面那堆代码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.
不好意思,还有个编码问题,获取用户昵称的时候,✨Katherine是用户的昵称,到了wxpy里面就成了❇Katherine,这个怎么解决呢
from wxpy.
你好:
我在调用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.
@powersam 最近了解到,似乎Web微信开始屏蔽微信ID
了,所以请使用wxpy的用户对象,或类似@1234567890abcdef...
的 user_name。
from wxpy.
@frank201524 这个编码的问题 wxpy 并没有特别处理呢,可以看看 wx.qq.com 中是不是也被转换了?
from wxpy.
@youfou 请问现在添加好友就什么好点的解决办法吗?如何使用wxpy对象来加好友,能否给个例子?
from wxpy.
wxpy
user_name是对自己好友才有的,已经是好友了还加什么呢?现在能否说明一下添加好友这个接口到底可以用不(通过微信号,手机号什么的)
from wxpy.
Related Issues (20)
- 完全沒有辦法給自己發訊息,求救
- 我尝试微信群同步信息的功能,但是图片和视频有时同步不成功,有没有办法。 HOT 1
- 微信群同步文本视频图片信息,但是信息顺序错乱,有没有办法。 HOT 1
- 基于pc微信做吗?
- 微信群接收一条消息后怎样暂停接收该微信群的其他消息,等处理完后重新开启对该微信群的消息接收 HOT 1
- 无法接受到群消息
- 互助讨论群 HOT 1
- 不到一天就退出登录了,要怎么办 HOT 6
- wxpy 在python3.8下出错。 HOT 3
- Cannot auto reply with @bot.register()
- 【研发必看!!!】做机器人,小助手,营销系统,客服系统,监管系统的可以 看下这个API方案 https://www.wkteam.cn/ HOT 1
- Support for ItChat 1.3+
- 是不是不能用了? HOT 4
- send_video 为什么报错raise ResponseError(err_code=err_code, err_msg=err_msg)
- 【研发必看!!!】做机器人,小助手,营销系统,客服系统,监管系统的可以 看下这个API方案 https://www.wkteam.cn/
- 微信扫码后出现,“KeyError:pass_ticket"
- 散了吧,微信已屏蔽 HOT 3
- 【研发必看!!!】做机器人,小助手,营销系统,客服系统,监管系统的可以 看下这个API方案 https://www.wkteam.cn/ #458
- 曝光一个是骗子~大家小心!!!【往事随风】【绝版先生】 HOT 2
- 现在能用什么办法监控到微信群消息吗
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wxpy.