mirror of
https://github.com/smallevilbeast/ntchat.git
synced 2025-07-07 17:56:08 +08:00
添加消息轰炸机示例
This commit is contained in:
parent
91d1257220
commit
008e6867ef
|
@ -1,6 +1,6 @@
|
||||||
<h1 align="center">NtChat</h1>
|
<h1 align="center">NtChat</h1>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/smallevilbeast/ntchat/releases"><img src="https://img.shields.io/badge/release-0.1.8-blue.svg?" alt="release"></a>
|
<a href="https://github.com/smallevilbeast/ntchat/releases"><img src="https://img.shields.io/badge/release-0.1.10-blue.svg?" alt="release"></a>
|
||||||
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg?" alt="License"></a>
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg?" alt="License"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
43
examples/bomber.py
Normal file
43
examples/bomber.py
Normal file
|
@ -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_()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
VERSION = '0.1.8'
|
VERSION = '0.1.10'
|
||||||
|
|
||||||
LOG_LEVEL = "DEBUG"
|
LOG_LEVEL = "DEBUG"
|
||||||
LOG_KEY = 'NTCHAT_LOG'
|
LOG_KEY = 'NTCHAT_LOG'
|
||||||
|
|
|
@ -201,7 +201,7 @@ class WeChat:
|
||||||
account: Union[None, str] = None,
|
account: Union[None, str] = None,
|
||||||
nickname: Union[None, str] = None,
|
nickname: Union[None, str] = None,
|
||||||
remark: Union[None, str] = None,
|
remark: Union[None, str] = None,
|
||||||
fuzzy_search: bool = False):
|
fuzzy_search: bool = True):
|
||||||
"""
|
"""
|
||||||
根据wxid、微信号、昵称和备注模糊搜索联系人
|
根据wxid、微信号、昵称和备注模糊搜索联系人
|
||||||
"""
|
"""
|
||||||
|
@ -225,7 +225,6 @@ class WeChat:
|
||||||
cond_str = " or ".join(cond_pairs)
|
cond_str = " or ".join(cond_pairs)
|
||||||
sql = f"select username from contact where {cond_str}"
|
sql = f"select username from contact where {cond_str}"
|
||||||
message = self.sql_query(sql, 1)
|
message = self.sql_query(sql, 1)
|
||||||
print(message)
|
|
||||||
if not message:
|
if not message:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -194,7 +194,7 @@ extension.extra_compile_cpp_args = extra_compile_cpp_args[target_os]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='ntchat',
|
name='ntchat',
|
||||||
version='0.1.8',
|
version='0.1.10',
|
||||||
description='About Conversational RPA SDK for Chatbot Makers',
|
description='About Conversational RPA SDK for Chatbot Makers',
|
||||||
long_description="",
|
long_description="",
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user