Skip to content

Commit cdcd29f

Browse files
committed
Updated docs and upload 1.2.0 to pypi
1 parent c5714bd commit cdcd29f

File tree

4 files changed

+124
-4
lines changed

4 files changed

+124
-4
lines changed

README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,46 @@ def download_files(msg):
168168
f.write(msg['Text']())
169169
```
170170

171+
### 用户多开
172+
173+
使用如下命令可以完成多开的操作:
174+
175+
```python
176+
import itchat
177+
178+
newInstance = itchat.new_instance()
179+
newInstance.auto_login(hotReload=True, statusStorageDir='newInstance.pkl')
180+
181+
@newInstance.msg_register(TEXT)
182+
def reply(msg):
183+
return msg['Text']
184+
185+
newInstance.run()
186+
```
187+
188+
### 退出及登陆完成后调用特定方法
189+
190+
登陆完成后的方法需要赋值在`loginCallback`中。
191+
192+
而退出后的方法需要赋值在`exitCallback`中。
193+
194+
```python
195+
import time
196+
197+
import itchat
198+
199+
def lc():
200+
print('finish login')
201+
def ec():
202+
print('exit')
203+
204+
itchat.auto_login(loginCallback=lc, exitCallback=ec)
205+
time.sleep(3)
206+
itchat.logout()
207+
```
208+
209+
若不设置loginCallback的值,则将会自动删除二维码图片并清空命令行显示。
210+
171211
## 常见问题与解答
172212

173213
Q: 为什么中文的文件没有办法上传?
@@ -184,7 +224,7 @@ A: 有两种方式:发送、接受自己UserName的消息;发送接收文件
184224

185225
Q: 为什么我发送信息的时候部分信息没有成功发出来?
186226

187-
A: 有些账号是天生无法给自己的账号发送信息的,建议使用`filehelper`代替。另外,接口调用是有频率限制,限制一下连续发送信息之间的时间间隔即可。
227+
A: 有些账号是天生无法给自己的账号发送信息的,建议使用`filehelper`代替。
188228

189229
## 作者
190230

README.rst

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,46 @@ If you don't want a local copy of the picture, you may pass nothing to the funct
166166
with open(msg['FileName'], 'wb') as f:
167167
f.write(msg['Text']())
168168
169+
*Multi instance*
170+
171+
You may use the following commands to open multi instance.
172+
173+
.. code:: python
174+
175+
import itchat
176+
177+
newInstance = itchat.new_instance()
178+
newInstance.auto_login(hotReload=True, statusStorageDir='newInstance.pkl')
179+
180+
@newInstance.msg_register(TEXT)
181+
def reply(msg):
182+
return msg['Text']
183+
184+
newInstance.run()
185+
186+
*Set callback after login and logout*
187+
188+
Callback of login and logout are set through `loginCallback` and `exitCallback`.
189+
190+
.. code:: python
191+
192+
import time
193+
194+
import itchat
195+
196+
def lc():
197+
print('finish login')
198+
def ec():
199+
print('exit')
200+
201+
itchat.auto_login(loginCallback=lc, exitCallback=ec)
202+
time.sleep(3)
203+
itchat.logout()
204+
205+
If loginCallback is not set, qr picture will be deleted and cmd will be cleared.
206+
207+
If you exit through phone, exitCallback will also be called.
208+
169209
**FAQ**
170210

171211
Q: Why I can't send files whose name is encoded in utf8?
@@ -182,7 +222,7 @@ A: There are two ways: communicate with your own account or with filehelper.
182222

183223
Q: Why sometimes I can't send messages?
184224

185-
A: Some account simply can't send messages to yourself, so use `filehelper` instead. Besides, there's limitation in calling api, so set some gap between them.
225+
A: Some account simply can't send messages to yourself, so use `filehelper` instead.
186226

187227
**Comments**
188228

README_EN.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,46 @@ def download_files(msg):
168168
f.write(msg['Text']())
169169
```
170170

171+
### Multi instance
172+
173+
You may use the following commands to open multi instance.
174+
175+
```python
176+
import itchat
177+
178+
newInstance = itchat.new_instance()
179+
newInstance.auto_login(hotReload=True, statusStorageDir='newInstance.pkl')
180+
181+
@newInstance.msg_register(TEXT)
182+
def reply(msg):
183+
return msg['Text']
184+
185+
newInstance.run()
186+
```
187+
188+
### Set callback after login and logout
189+
190+
Callback of login and logout are set through `loginCallback` and `exitCallback`.
191+
192+
```python
193+
import time
194+
195+
import itchat
196+
197+
def lc():
198+
print('finish login')
199+
def ec():
200+
print('exit')
201+
202+
itchat.auto_login(loginCallback=lc, exitCallback=ec)
203+
time.sleep(3)
204+
itchat.logout()
205+
```
206+
207+
If loginCallback is not set, qr picture will be deleted and cmd will be cleared.
208+
209+
If you exit through phone, exitCallback will also be called.
210+
171211
## FAQ
172212

173213
Q: Why I can't upload files whose name is not purely english?
@@ -184,7 +224,7 @@ A: There are two ways: communicate with your own account or with filehelper.
184224

185225
Q: Why sometimes I can't send messages?
186226

187-
A: Some account simply can't send messages to yourself, so use `filehelper` instead. Besides, there's limitation in calling api, so set some gap between them.
227+
A: Some account simply can't send messages to yourself, so use `filehelper` instead.
188228

189229
## Author
190230

itchat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from . import content
33
from .log import set_logging
44

5-
__version__ = '1.1.21'
5+
__version__ = '1.2.0'
66

77
instanceList = []
88

0 commit comments

Comments
 (0)