🎨 不自动启动gsuid_core

This commit is contained in:
Wuyi无疑 2023-03-11 22:14:48 +08:00
parent afd91410a0
commit c686a3ac81

View File

@ -8,12 +8,12 @@ from nonebot.internal.adapter import Event
from nonebot import get_driver, on_message, on_fullmatch from nonebot import get_driver, on_message, on_fullmatch
from .client import GsClient from .client import GsClient
from .auto_install import start, install from .auto_install import install
from .models import Message, MessageReceive from .models import Message, MessageReceive
get_message = on_message(priority=999) get_message = on_message(priority=999)
install_core = on_fullmatch('gs一键安装', permission=SUPERUSER, block=True) install_core = on_fullmatch('gs一键安装', permission=SUPERUSER, block=True)
start_core = on_fullmatch('启动core', permission=SUPERUSER, block=True) connect_core = on_fullmatch('连接core', permission=SUPERUSER, block=True)
driver = get_driver() driver = get_driver()
gsclient: Optional[GsClient] = None gsclient: Optional[GsClient] = None
@ -37,7 +37,7 @@ async def send_char_adv(bot: Bot, ev: Event):
pm = 3 pm = 3
if await SUPERUSER(bot, ev): if await SUPERUSER(bot, ev):
pm = 2 pm = 1
# qqguild # qqguild
if '_message' in raw_data: if '_message' in raw_data:
@ -103,17 +103,16 @@ async def send_install_msg(matcher: Matcher):
await matcher.send(await install()) await matcher.send(await install())
@start_core.handle() @connect_core.handle()
async def send_start_msg(matcher: Matcher): async def send_start_msg(matcher: Matcher):
await start_client() await start_client()
await matcher.send('启动完成...') await matcher.send('链接成功!...')
@driver.on_bot_connect @driver.on_bot_connect
async def start_client(): async def start_client():
if gsclient is None: if gsclient is None:
await start() await connect()
await connect()
async def connect(): async def connect():
@ -123,4 +122,3 @@ async def connect():
await gsclient.start() await gsclient.start()
except ConnectionRefusedError: except ConnectionRefusedError:
logger.error('Core服务器连接失败...请稍后使用[启动core]命令启动...') logger.error('Core服务器连接失败...请稍后使用[启动core]命令启动...')
logger.error('Core服务器连接失败...请稍后使用[启动core]命令启动...')