From 3254ac2d096fe360394dd8f8e6800ece9fa174b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wuyi=E6=97=A0=E7=96=91?= <444835641@qq.com> Date: Sun, 26 Mar 2023 19:22:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E4=BC=98=E5=8C=96=E5=A4=9A?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GenshinUID/client.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/GenshinUID/client.py b/GenshinUID/client.py index 261ac617..a7e59d91 100644 --- a/GenshinUID/client.py +++ b/GenshinUID/client.py @@ -4,6 +4,7 @@ import asyncio from pathlib import Path from typing import Dict, List, Union, Optional +import hoshino import websockets.client from msgspec import json as msgjson from websockets.exceptions import ConnectionClosedError @@ -45,7 +46,6 @@ class GsClient: continue bot = hoshino_bot - # self_ids = hoshino.get_self_ids() content = '' image: Optional[str] = None @@ -70,17 +70,23 @@ class GsClient: # 根据bot_id字段发送消息 # OneBot v11 & v12 - if msg.bot_id == 'onebot': - await onebot_send( - bot, - content, - image, - node, - file, - msg.bot_self_id, - msg.target_id, - msg.target_type, - ) + if not msg.bot_self_id: + self_ids = hoshino.get_self_ids() + else: + self_ids = [msg.bot_self_id] + + for ids in self_ids: + if msg.bot_id == 'onebot': + await onebot_send( + bot, + content, + image, + node, + file, + ids, + msg.target_id, + msg.target_type, + ) except Exception as e: logger.error(e) except RuntimeError: