Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions nonebot_plugin_bililive/database/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from nonebot import get_driver, logger
from packaging.version import Version as version_parser
from tortoise import Tortoise
from tortoise.connection import connections

from ..utils import get_path
from ..version import VERSION as APP_VERSION
Expand Down Expand Up @@ -57,7 +56,7 @@ async def init(cls):
async def close(cls):
cls._ready = False
await cls.save_dynamic_offsets()
await connections.close_all()
await Tortoise.close_connections()

@classmethod
async def wait_until_ready(cls, timeout: float = 30) -> bool:
Expand Down
3 changes: 3 additions & 0 deletions nonebot_plugin_bililive/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ async def permission_check(
raise FinishedException
return
if isinstance(event, GroupMessageEvent):
if not await db.wait_until_ready():
await bot.send(event, "数据库尚未初始化完成,请稍后再试")
raise FinishedException
if not await db.get_group_admin(event.group_id):
return
if await (GROUP_ADMIN | GROUP_OWNER | SUPERUSER)(bot, event):
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_bililive/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from packaging.version import Version

__version__ = "2.1.3"
__version__ = "2.1.4"
VERSION = Version(__version__)
Loading