🎨 修复空UID仍然输出log(#316)

This commit is contained in:
KimgiaiiWuyi 2022-09-03 17:47:44 +08:00
parent 7ff9c3896f
commit 5b2703fa24
2 changed files with 4 additions and 6 deletions

View File

@ -11,9 +11,6 @@ from ..utils.mhy_api.convert_mysid_to_uid import convert_mysid
)
async def send_role_info(bot: HoshinoBot, ev: CQEvent):
args = ev['match'].groups()
logger.info('开始执行[查询角色信息]')
logger.info('[查询角色信息]参数: {}'.format(args))
at = re.search(r'\[CQ:at,qq=(\d*)]', str(ev.message))
if at:
@ -28,7 +25,6 @@ async def send_role_info(bot: HoshinoBot, ev: CQEvent):
if args[2] != 'mys':
if args[3] is None:
if args[2] is None:
logger.info('[查询角色信息]uid为空, 直接结束~')
return
uid = await select_db(qid, mode='uid')
uid = str(uid)
@ -39,6 +35,8 @@ async def send_role_info(bot: HoshinoBot, ev: CQEvent):
else:
uid = await convert_mysid(args[3])
logger.info('开始执行[查询角色信息]')
logger.info('[查询角色信息]参数: {}'.format(args))
logger.info('[查询角色信息]uid: {}'.format(uid))
if '未找到绑定的UID' in uid:

View File

@ -57,7 +57,7 @@ async def get_gacha_log_by_authkey(
) -> Optional[dict]:
server_id = 'cn_qd01' if uid[0] == '5' else 'cn_gf01'
authkey_rawdata = await get_authkey_by_cookie(uid)
if authkey_rawdata == {}:
if authkey_rawdata == {} or authkey_rawdata is None:
return None
if 'data' in authkey_rawdata and 'authkey' in authkey_rawdata['data']:
authkey = authkey_rawdata['data']['authkey']
@ -125,7 +125,7 @@ async def get_authkey_by_cookie(uid: str) -> dict:
server_id = 'cn_qd01' if uid[0] == '5' else 'cn_gf01'
HEADER = copy.deepcopy(_HEADER)
stoken = await get_stoken(uid)
if stoken == '该用户没有绑定过Stoken噢~':
if stoken == '该用户没有绑定过Stoken噢~' or stoken == '':
return {}
HEADER['Cookie'] = stoken
HEADER['DS'] = old_version_get_ds_token(True)