From 92dc28877667e5e2736f5fcd1396064c4a9d3bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wuyi=E6=97=A0=E7=96=91?= <444835641@qq.com> Date: Sat, 11 Mar 2023 18:45:37 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E9=80=82=E9=85=8D=E9=A2=91?= =?UTF-8?q?=E9=81=93=E7=A7=81=E4=BF=A1=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GenshinUID/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/GenshinUID/__init__.py b/GenshinUID/__init__.py index e41662b4..94373bfc 100644 --- a/GenshinUID/__init__.py +++ b/GenshinUID/__init__.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import List, Literal, Optional from nonebot.log import logger from nonebot.matcher import Matcher @@ -30,13 +30,16 @@ async def send_char_adv(ev: Event): group_id = sessions[-2] if len(sessions) >= 2 else None message: List[Message] = [] msg_id = '' + sp_user_type: Optional[ + Literal['group', 'direct', 'channel', 'sub_channel'] + ] = None # qqguild if '_message' in raw_data: messages = raw_data['_message'] if 'direct_message' in raw_data and raw_data['direct_message']: - group_id = None - user_id = str(raw_data['guild_id']) + sp_user_type = 'direct' + group_id = str(raw_data['guild_id']) else: group_id = str(raw_data['channel_id']) msg_id = raw_data['id'] @@ -75,9 +78,10 @@ async def send_char_adv(ev: Event): if not message: return + user_type = 'group' if group_id else 'direct' msg = MessageReceive( bot_id=bot_id, - user_type='group' if group_id else 'direct', + user_type=sp_user_type if sp_user_type else user_type, group_id=group_id, user_id=user_id, content=message,