forked from billyplus/ntchat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91d1257
commit 008e686
Showing
5 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
import os | ||
os.environ['NTCHAT_LOG'] = "ERROR" | ||
|
||
import time | ||
import ntchat | ||
|
||
wechat = ntchat.WeChat() | ||
wechat.open(smart=True) | ||
|
||
print("正在登录微信") | ||
wechat.wait_login() | ||
|
||
peer_wxid = None | ||
|
||
while True: | ||
contact_remark = input("请输入想发送的联系人备注: ") | ||
contacts = wechat.search_contacts(remark=contact_remark) | ||
if not contacts: | ||
print(f"没有搜索到备注是{contact_remark}的联系人") | ||
else: | ||
print(f"搜索到{len(contacts)}个联系人: ") | ||
print("0. 重新选择") | ||
for i, contact in enumerate(contacts): | ||
print(f"{i+1}. 昵称: {contact['nickname']}, 备注: {contact['remark']}") | ||
seq = int(input("输入上面编号进行选择: ")) | ||
if seq != 0: | ||
peer_wxid = contacts[seq-1]["wxid"] | ||
break | ||
|
||
content = input("请输入发送的内容: ") | ||
number = int(input("请输入发送的次数: ")) | ||
|
||
for i in range(1, number+1): | ||
time.sleep(0.1) | ||
print("正在发送第%d遍" % i) | ||
wechat.send_text(to_wxid=peer_wxid, content=content) | ||
|
||
|
||
ntchat.exit_() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
VERSION = '0.1.8' | ||
VERSION = '0.1.10' | ||
|
||
LOG_LEVEL = "DEBUG" | ||
LOG_KEY = 'NTCHAT_LOG' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters