fix: wxcomapp user name

This commit is contained in:
zhayujie
2024-01-31 16:24:29 +08:00
parent 7e0fbd600f
commit 95708489c9
2 changed files with 13 additions and 4 deletions

View File

@@ -106,8 +106,12 @@ class LinkAIBot(Bot):
body["is_group"] = True
body["group_name"] = context.kwargs.get("msg").from_user_nickname
body["sender_name"] = context.kwargs.get("msg").actual_user_nickname
else:
if body.get("channel_type") in ["wechatcom_app"]:
body["sender_name"] = context.kwargs.get("msg").from_user_id
else:
body["sender_name"] = context.kwargs.get("msg").from_user_nickname
except Exception as e:
pass
file_id = context.kwargs.get("file_id")

View File

@@ -251,6 +251,7 @@ class WechatChannel(ChatChannel):
def _send_login_success():
try:
from common.linkai_client import chat_client
if chat_client.client_id:
chat_client.send_login_success()
except Exception as e:
pass
@@ -258,6 +259,8 @@ def _send_login_success():
def _send_logout():
try:
from common.linkai_client import chat_client
time.sleep(2)
if chat_client.client_id:
chat_client.send_logout()
except Exception as e:
pass
@@ -265,6 +268,8 @@ def _send_logout():
def _send_qr_code(qrcode_list: list):
try:
from common.linkai_client import chat_client
time.sleep(2)
if chat_client.client_id:
chat_client.send_qrcode(qrcode_list)
except Exception as e:
pass