mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-12 06:55:58 +08:00
🎨 优化多连接适配
This commit is contained in:
parent
8f299585f5
commit
3254ac2d09
@ -4,6 +4,7 @@ import asyncio
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Union, Optional
|
from typing import Dict, List, Union, Optional
|
||||||
|
|
||||||
|
import hoshino
|
||||||
import websockets.client
|
import websockets.client
|
||||||
from msgspec import json as msgjson
|
from msgspec import json as msgjson
|
||||||
from websockets.exceptions import ConnectionClosedError
|
from websockets.exceptions import ConnectionClosedError
|
||||||
@ -45,7 +46,6 @@ class GsClient:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
bot = hoshino_bot
|
bot = hoshino_bot
|
||||||
# self_ids = hoshino.get_self_ids()
|
|
||||||
|
|
||||||
content = ''
|
content = ''
|
||||||
image: Optional[str] = None
|
image: Optional[str] = None
|
||||||
@ -70,17 +70,23 @@ class GsClient:
|
|||||||
|
|
||||||
# 根据bot_id字段发送消息
|
# 根据bot_id字段发送消息
|
||||||
# OneBot v11 & v12
|
# OneBot v11 & v12
|
||||||
if msg.bot_id == 'onebot':
|
if not msg.bot_self_id:
|
||||||
await onebot_send(
|
self_ids = hoshino.get_self_ids()
|
||||||
bot,
|
else:
|
||||||
content,
|
self_ids = [msg.bot_self_id]
|
||||||
image,
|
|
||||||
node,
|
for ids in self_ids:
|
||||||
file,
|
if msg.bot_id == 'onebot':
|
||||||
msg.bot_self_id,
|
await onebot_send(
|
||||||
msg.target_id,
|
bot,
|
||||||
msg.target_type,
|
content,
|
||||||
)
|
image,
|
||||||
|
node,
|
||||||
|
file,
|
||||||
|
ids,
|
||||||
|
msg.target_id,
|
||||||
|
msg.target_type,
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user