mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-12 06:55:58 +08:00
🐛 修复可能发起多个连接的bug (#541)
* 修复可能发起多个连接的bug
* 🚨 `pre-commit-ci`修复格式错误
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
dedaf0a65f
commit
9383755899
@ -10,15 +10,22 @@ from .base import sv, logger, hoshino_bot
|
|||||||
from .models import Message, MessageReceive
|
from .models import Message, MessageReceive
|
||||||
|
|
||||||
gsclient: Optional[GsClient] = None
|
gsclient: Optional[GsClient] = None
|
||||||
|
gsconnecting = False
|
||||||
|
|
||||||
|
|
||||||
async def connect():
|
async def connect():
|
||||||
global gsclient
|
global gsclient
|
||||||
try:
|
global gsconnecting
|
||||||
gsclient = await GsClient().async_connect()
|
if not gsconnecting:
|
||||||
await gsclient.start()
|
gsconnecting = True
|
||||||
except ConnectionRefusedError:
|
try:
|
||||||
logger.error('Core服务器连接失败...请稍后使用[启动core]命令启动...')
|
gsclient = await GsClient().async_connect()
|
||||||
|
logger.info('[gsuid-core]: 发起一次连接')
|
||||||
|
await gsclient.start()
|
||||||
|
gsconnecting = False
|
||||||
|
except ConnectionRefusedError:
|
||||||
|
gsconnecting = False
|
||||||
|
logger.error('Core服务器连接失败...请稍后使用[启动core]命令启动...')
|
||||||
|
|
||||||
|
|
||||||
async def get_gs_msg(ev):
|
async def get_gs_msg(ev):
|
||||||
@ -128,7 +135,7 @@ async def import_gacha_log_info(session: NoticeSession):
|
|||||||
|
|
||||||
msg_id = ''
|
msg_id = ''
|
||||||
pm = 6
|
pm = 6
|
||||||
|
|
||||||
if 'message_type' in ev:
|
if 'message_type' in ev:
|
||||||
if priv.check_priv(ev, priv.SUPERUSER):
|
if priv.check_priv(ev, priv.SUPERUSER):
|
||||||
pm = 1
|
pm = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user