mirror of
https://github.com/smallevilbeast/ntchat.git
synced 2025-09-04 20:06:06 +08:00
添加退出例子,发布0.1.4版本
This commit is contained in:
parent
594cc561cb
commit
9505e69779
|
@ -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.3-blue.svg?" alt="release"></a>
|
<a href="https://github.com/smallevilbeast/ntchat/releases"><img src="https://img.shields.io/badge/release-0.1.4-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>
|
||||||
|
|
||||||
|
|
38
examples/quit_event.py
Normal file
38
examples/quit_event.py
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import ntchat
|
||||||
|
|
||||||
|
|
||||||
|
def version_tuple(v):
|
||||||
|
return tuple(map(int, (v.split("."))))
|
||||||
|
|
||||||
|
|
||||||
|
if version_tuple(ntchat.__version__) < version_tuple('0.1.4'):
|
||||||
|
print("error: ntchat version required 0.1.4, use `pip install -U ntchat` to upgrade")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
wechat = ntchat.WeChat()
|
||||||
|
|
||||||
|
# 打开pc微信, smart: 是否管理已经登录的微信
|
||||||
|
wechat.open(smart=True)
|
||||||
|
|
||||||
|
global_quit_flag = False
|
||||||
|
|
||||||
|
|
||||||
|
# 微信进程关闭通知
|
||||||
|
@wechat.msg_register(ntchat.MT_RECV_WECHAT_QUIT_MSG)
|
||||||
|
def on_wechat_quit(wechat_instace):
|
||||||
|
print("###################")
|
||||||
|
global global_quit_flag
|
||||||
|
global_quit_flag = True
|
||||||
|
|
||||||
|
|
||||||
|
# 以下是为了让程序不结束,如果有用于PyQt等有主循环消息的框架,可以去除下面代码
|
||||||
|
while True:
|
||||||
|
if global_quit_flag:
|
||||||
|
break
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
ntchat.exit_()
|
||||||
|
sys.exit()
|
|
@ -1,4 +1,4 @@
|
||||||
VERSION = '0.1.3'
|
VERSION = '0.1.4'
|
||||||
|
|
||||||
LOG_LEVEL = "DEBUG"
|
LOG_LEVEL = "DEBUG"
|
||||||
LOG_KEY = 'NTCHAT_LOG'
|
LOG_KEY = 'NTCHAT_LOG'
|
||||||
|
|
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.3',
|
version='0.1.4',
|
||||||
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