mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
⚡ 添加旧版本兼容
This commit is contained in:
parent
c8c21d7370
commit
6790a597c4
@ -23,8 +23,13 @@ from .config import (
|
|||||||
from .exceptions import DbConnectError, DbUrlIsNode
|
from .exceptions import DbConnectError, DbUrlIsNode
|
||||||
from .utils import with_db_timeout
|
from .utils import with_db_timeout
|
||||||
|
|
||||||
|
MODELS = db_model.models
|
||||||
|
SCRIPT_METHOD = db_model.script_method
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"DB_TIMEOUT_SECONDS",
|
"DB_TIMEOUT_SECONDS",
|
||||||
|
"MODELS",
|
||||||
|
"SCRIPT_METHOD",
|
||||||
"SLOW_QUERY_THRESHOLD",
|
"SLOW_QUERY_THRESHOLD",
|
||||||
"DbConnectError",
|
"DbConnectError",
|
||||||
"DbUrlIsNode",
|
"DbUrlIsNode",
|
||||||
@ -93,6 +98,10 @@ def get_config() -> dict:
|
|||||||
|
|
||||||
@PriorityLifecycle.on_startup(priority=1)
|
@PriorityLifecycle.on_startup(priority=1)
|
||||||
async def init():
|
async def init():
|
||||||
|
global MODELS, SCRIPT_METHOD
|
||||||
|
|
||||||
|
MODELS = db_model.models
|
||||||
|
SCRIPT_METHOD = db_model.script_method
|
||||||
if not BotConfig.db_url:
|
if not BotConfig.db_url:
|
||||||
error = prompt.format(host=driver.config.host, port=driver.config.port)
|
error = prompt.format(host=driver.config.host, port=driver.config.port)
|
||||||
raise DbUrlIsNode("\n" + error.strip())
|
raise DbUrlIsNode("\n" + error.strip())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user