mirror of
https://github.com/smallevilbeast/ntchat.git
synced 2026-07-02 04:32:43 +08:00
新增常见问题文档
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import time
|
||||
import ntchat
|
||||
|
||||
wechat = ntchat.WeChat()
|
||||
|
||||
# 打开pc微信, smart: 是否管理已经登录的微信
|
||||
wechat.open(smart=True)
|
||||
|
||||
|
||||
# 注册监听所有消息回调
|
||||
@wechat.msg_register(ntchat.MT_ALL)
|
||||
def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):
|
||||
print("########################")
|
||||
print(message)
|
||||
|
||||
|
||||
# 以下是为了让程序不结束,如果有用于PyQt等有主循环消息的框架,可以去除下面代码
|
||||
try:
|
||||
while True:
|
||||
time.sleep(0.5)
|
||||
except KeyboardInterrupt:
|
||||
ntchat.exit_()
|
||||
sys.exit()
|
||||
Reference in New Issue
Block a user