mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-07-27 19:10:55 +00:00
✨ 新增安全模式启动
This commit is contained in:
@ -36,12 +36,18 @@ def load_from_yaml(file: str) -> dict:
|
||||
return conf
|
||||
|
||||
|
||||
def get_config(key: str, *, bot: T_Bot = None, default=None):
|
||||
def get_config(key: str, default=None):
|
||||
"""获取配置项,优先级:bot > config > db > yaml"""
|
||||
try:
|
||||
bot = nonebot.get_bot()
|
||||
except:
|
||||
bot = None
|
||||
|
||||
if bot is None:
|
||||
bot_config = {}
|
||||
else:
|
||||
bot_config = bot.config.dict()
|
||||
|
||||
if key in bot_config:
|
||||
return bot_config[key]
|
||||
|
||||
|
Reference in New Issue
Block a user