Commit 008e686 1 parent 91d1257 commit 008e686 Copy full SHA for 008e686
File tree 5 files changed +47
-5
lines changed
5 files changed +47
-5
lines changed Original file line number Diff line number Diff line change 1
1
<h1 align =" center " >NtChat</h1 >
2
2
<p align =" center " >
3
- <a href="https://github.com/smallevilbeast/ntchat/releases"><img src="https://img.shields.io/badge/release-0.1.8 -blue.svg?" alt="release"></a>
3
+ <a href="https://github.com/smallevilbeast/ntchat/releases"><img src="https://img.shields.io/badge/release-0.1.10 -blue.svg?" alt="release"></a>
4
4
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg?" alt="License"></a>
5
5
</p >
6
6
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ import os
3
+ os .environ ['NTCHAT_LOG' ] = "ERROR"
4
+
5
+ import time
6
+ import ntchat
7
+
8
+ wechat = ntchat .WeChat ()
9
+ wechat .open (smart = True )
10
+
11
+ print ("正在登录微信" )
12
+ wechat .wait_login ()
13
+
14
+ peer_wxid = None
15
+
16
+ while True :
17
+ contact_remark = input ("请输入想发送的联系人备注: " )
18
+ contacts = wechat .search_contacts (remark = contact_remark )
19
+ if not contacts :
20
+ print (f"没有搜索到备注是{ contact_remark } 的联系人" )
21
+ else :
22
+ print (f"搜索到{ len (contacts )} 个联系人: " )
23
+ print ("0. 重新选择" )
24
+ for i , contact in enumerate (contacts ):
25
+ print (f"{ i + 1 } . 昵称: { contact ['nickname' ]} , 备注: { contact ['remark' ]} " )
26
+ seq = int (input ("输入上面编号进行选择: " ))
27
+ if seq != 0 :
28
+ peer_wxid = contacts [seq - 1 ]["wxid" ]
29
+ break
30
+
31
+ content = input ("请输入发送的内容: " )
32
+ number = int (input ("请输入发送的次数: " ))
33
+
34
+ for i in range (1 , number + 1 ):
35
+ time .sleep (0.1 )
36
+ print ("正在发送第%d遍" % i )
37
+ wechat .send_text (to_wxid = peer_wxid , content = content )
38
+
39
+
40
+ ntchat .exit_ ()
41
+
42
+
43
+
Original file line number Diff line number Diff line change 1
- VERSION = '0.1.8 '
1
+ VERSION = '0.1.10 '
2
2
3
3
LOG_LEVEL = "DEBUG"
4
4
LOG_KEY = 'NTCHAT_LOG'
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ def search_contacts(self,
201
201
account : Union [None , str ] = None ,
202
202
nickname : Union [None , str ] = None ,
203
203
remark : Union [None , str ] = None ,
204
- fuzzy_search : bool = False ):
204
+ fuzzy_search : bool = True ):
205
205
"""
206
206
根据wxid、微信号、昵称和备注模糊搜索联系人
207
207
"""
@@ -225,7 +225,6 @@ def search_contacts(self,
225
225
cond_str = " or " .join (cond_pairs )
226
226
sql = f"select username from contact where { cond_str } "
227
227
message = self .sql_query (sql , 1 )
228
- print (message )
229
228
if not message :
230
229
return []
231
230
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ def add_prefix(l, prefix):
194
194
195
195
setup (
196
196
name = 'ntchat' ,
197
- version = '0.1.8 ' ,
197
+ version = '0.1.10 ' ,
198
198
description = 'About Conversational RPA SDK for Chatbot Makers' ,
199
199
long_description = "" ,
200
200
long_description_content_type = 'text/markdown' ,
You can’t perform that action at this time.
0 commit comments