mirror of
https://github.com/smallevilbeast/ntchat.git
synced 2025-05-23 05:29:43 +08:00
修改echo_bot例子不回复群消息
This commit is contained in:
parent
0fc8d21920
commit
7e1bf189ee
|
@ -15,9 +15,10 @@ def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):
|
|||
data = message["data"]
|
||||
from_wxid = data["from_wxid"]
|
||||
self_wxid = wechat_instance.get_login_info()["wxid"]
|
||||
room_wxid = data["room_wxid"]
|
||||
|
||||
# 判断消息不是自己发的,并回复对方
|
||||
if from_wxid != self_wxid:
|
||||
# 判断消息不是自己发的并且不是群消息时,回复对方
|
||||
if from_wxid != self_wxid and not room_wxid:
|
||||
wechat_instance.send_text(to_wxid=from_wxid, content=f"你发送的消息是: {data['msg']}")
|
||||
|
||||
|
||||
|
|
|
@ -12,9 +12,10 @@ def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):
|
|||
data = message["data"]
|
||||
from_wxid = data["from_wxid"]
|
||||
self_wxid = wechat_instance.get_login_info()["wxid"]
|
||||
room_wxid = data["room_wxid"]
|
||||
|
||||
# 判断消息不是自己发的,并回复对方
|
||||
if from_wxid != self_wxid:
|
||||
# 判断消息不是自己发的并且不是群消息时,回复对方
|
||||
if from_wxid != self_wxid and not room_wxid:
|
||||
wechat_instance.send_text(to_wxid=from_wxid, content=f"你发送的消息是: {data['msg']}")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user