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

收到 1102 retcode 后更新微信服务器轮询地址 #205

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
8fff2d6
add QQ group
Aug 17, 2016
d635c8d
Merge pull request #101 from thriteen/master
liuwons Aug 17, 2016
134ae98
Merge pull request #104 from thriteen/master
liuwons Aug 17, 2016
a95b4d0
reformat code
Aug 17, 2016
88c815f
fix null pointer
Aug 17, 2016
addc616
自动响应好友请求
vivre90 Aug 26, 2016
aea3551
Merge pull request #107 from vivre90/patch-2
liuwons Aug 26, 2016
ea1bda0
change url of upload_media
Aug 26, 2016
fae4cf1
change path for send file and img msg
Aug 26, 2016
faf1a30
exception fix
Aug 27, 2016
d7f99d1
新增3个群管接口
vivre90 Aug 27, 2016
ef6b3bd
Merge pull request #109 from vivre90/patch-3
liuwons Aug 27, 2016
e954caf
update README
Sep 29, 2016
c949109
change push url and file upload url
Oct 11, 2016
7db6de7
修复1102,0和-1,-1的问题
vivre90 Oct 12, 2016
5c74dbd
fix bug
vivre90 Oct 12, 2016
b60084e
fix bugs
vivre90 Oct 12, 2016
fd47c0d
Merge pull request #136 from vivre90/patch-4
liuwons Oct 12, 2016
d890799
test_sync_check 修复
vivre90 Oct 12, 2016
51c37e0
兼容sync,解决1102,0和-1,-1问题
vivre90 Oct 12, 2016
44ad4e8
Merge pull request #137 from vivre90/patch-5
liuwons Oct 12, 2016
b09cd76
fix
vivre90 Oct 12, 2016
614c875
Merge pull request #138 from vivre90/patch-6
liuwons Oct 12, 2016
95729f4
新增设置群聊名称接口--set_group_name
vivre90 Oct 13, 2016
f5e16cd
Merge pull request #144 from vivre90/patch-7
liuwons Oct 14, 2016
efe2c02
fix a syntax
xuncl Oct 14, 2016
cda1b6d
Merge pull request #145 from xuncl/master
xmcp Oct 14, 2016
bb44aca
更新心跳服务器获取方式,同时修复文件可能上传失败的问题! 在返回-1,-1时降低心跳获取频率!
vivre90 Oct 25, 2016
181dee1
Merge pull request #147 from vivre90/patch-1
liuwons Oct 26, 2016
efef7ee
fix bugs~~~
vivre90 Oct 26, 2016
d43918d
Merge pull request #148 from vivre90/patch-3
liuwons Oct 27, 2016
047bfe6
Add invite function for add user to group
Oct 29, 2016
596f5bb
修复了通讯录过大,无法获取通讯录的问题
twistfz Dec 7, 2016
2fff371
增加StatusNotifyCode的判断,更改replace为正则
twistfz Dec 8, 2016
23bd5ca
Merge pull request #163 from twistfz/fix-big-contact
liuwons Dec 8, 2016
f13ef3f
修改保存wxid变量名写错
twistfz Dec 21, 2016
c9c84a1
Merge pull request #167 from twistfz/fix-big-contact
liuwons Dec 21, 2016
072abe0
修复无法转换'\xa0'‘字符问题
archspider Dec 24, 2016
8712318
修复无法转换'\xa0'‘字符问题
archspider Dec 28, 2016
bb76cc7
Merge pull request #168 from archspider/master
liuwons Dec 29, 2016
50d3b3b
增加invite_friend_to_group方法,应对由于群人数过多造成的无法直接添加用户到群、add_friend_to_group…
SolessChong Jan 2, 2017
188aed5
Merge pull request #171 from SolessChong/master
liuwons Jan 2, 2017
c2f0ce6
fix bug that it can't find group personal name.
derrickcyt Jan 9, 2017
0528c01
Merge pull request #176 from derrickcyt/derrick
liuwons Jan 9, 2017
fad69e3
增加对小视频的支持
zhgcao Jan 11, 2017
fa2c62f
Merge pull request #179 from zhgcao/master
liuwons Jan 12, 2017
ea91255
Merge pull request #154 from mzymzy2003/master
liuwons Mar 8, 2017
1e9e639
pull request
Mar 8, 2017
60c2cd1
Merge pull request #194 from kliuj/master
liuwons Mar 8, 2017
a6637df
为了兼容WxbotManage,新增了一些属性和方法
vivre90 Mar 11, 2017
eab8fcf
新增WxbotManage系统介绍
vivre90 Mar 11, 2017
3443693
Merge pull request #199 from vivre90/patch-5
liuwons Mar 12, 2017
8be53df
Merge pull request #200 from vivre90/patch-6
liuwons Mar 12, 2017
f3e347a
收到1102 retcode 后更新微信服务器轮询地址
Mar 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ Web微信协议参考资料:

[qwx: WeChat Qt frontend 微信Qt前端](https://github.com/xiangzhai/qwx)

**master-dev 分支为开发版本,用于测试新特性,欢迎使用后提出建议!**


## 1 环境与依赖

此版本只能运行于Python 2环境 。

**wxBot** 用到了Python **requests** , **pypng** , **Pillow* 以及 **pyqrcode** 库。
**wxBot** 用到了Python **requests** , **pypng** , **Pillow** 以及 **pyqrcode** 库。

使用之前需要所依赖的库:

Expand Down Expand Up @@ -162,6 +164,7 @@ python test.py
| 10 | 撤回消息 | 不可用 |
| 11 | 空内容 | 空字符串 |
| 12 | 红包 | 不可用 |
| 13 | 小视频 | 字符串,视频数据的url,HTTP POST请求此url可以得到mp4文件格式的数据 |
| 99 | 未知类型 | 不可用 |

### 4.4 群文本消息
Expand Down Expand Up @@ -200,6 +203,7 @@ python test.py
| `get_head_img(id)` | 获取用户头像并保存到本地文件 ***img_[id].jpg*** ,`id` 为用户id(Web微信数据) |
| `get_msg_img(msgid)` | 获取图像消息并保存到本地文件 ***img_[msgid].jpg*** , `msgid` 为消息id(Web微信数据) |
| `get_voice(msgid)` | 获取语音消息并保存到本地文件 ***voice_[msgid].mp3*** , `msgid` 为消息id(Web微信数据) |
| `get_video(msgid)` | 获取视频消息并保存到本地文件 ***video_[msgid].mp4*** , `msgid` 为消息id(Web微信数据) |
| `get_contact_name(uid)` | 获取微信id对应的名称,返回一个可能包含 `remark_name` (备注名), `nickname` (昵称), `display_name` (群名称)的字典|
| `send_msg_by_uid(word, dst)` | 向好友发送消息,`word` 为消息字符串,`dst` 为好友用户id(Web微信数据) |
| `send_img_msg_by_uid(fpath, dst)` | 向好友发送图片消息,`fpath` 为本地图片文件路径,`dst` 为好友用户id(Web微信数据) |
Expand Down Expand Up @@ -264,3 +268,12 @@ python test.py
[Urinx/WeixinBot](https://github.com/Urinx/WeixinBot) 网页版微信API,包含终端版微信及微信机器人

[zixia/wechaty](https://github.com/zixia/wechaty) Wechaty is wechat for bot in Javascript(ES6). It's a Personal Account Robot Framework/Library.

## 7 基于Wxbot延伸的一些项目
[WxbotManage](https://coding.net/u/vivre/p/WxbotManage/git) 基于Wxbot的微信多开管理和Webapi系统

## 8 交流讨论

问题可以直接开 **issue**

**QQ** 交流群: **429134510**
4 changes: 3 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def tuling_auto_reply(self, uid, msg):
result = ''
if respond['code'] == 100000:
result = respond['text'].replace('<br>', ' ')
result = result.replace(u'\xa0', u' ')
elif respond['code'] == 200000:
result = respond['url']
elif respond['code'] == 302000:
Expand All @@ -39,6 +40,7 @@ def tuling_auto_reply(self, uid, msg):
k['article'] + "\t" + k['detailurl'] + "\n"
else:
result = respond['text'].replace('<br>', ' ')
result = result.replace(u'\xa0', u' ')

print ' ROBOT:', result
return result
Expand Down Expand Up @@ -69,7 +71,7 @@ def handle_msg_all(self, msg):
self.send_msg_by_uid(self.tuling_auto_reply(msg['user']['id'], msg['content']['data']), msg['user']['id'])
elif msg['msg_type_id'] == 3 and msg['content']['type'] == 0: # group text message
if 'detail' in msg['content']:
my_names = self.get_group_member_name(self.my_account['UserName'], msg['user']['id'])
my_names = self.get_group_member_name(msg['user']['id'], self.my_account['UserName'])
if my_names is None:
my_names = {}
if 'NickName' in self.my_account and self.my_account['NickName']:
Expand Down
2 changes: 2 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
# coding: utf-8
#

from wxbot import *

Expand All @@ -21,6 +22,7 @@ def main():
bot = MyWXBot()
bot.DEBUG = True
bot.conf['qr'] = 'png'
bot.is_big_contact = False #如果确定通讯录过大,无法获取,可以直接配置,跳过检查。假如不是过大的话,这个方法可能无法获取所有的联系人
bot.run()


Expand Down
Loading