mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 10:17:56 +08:00
✨ rename bison_theme_use_browser -> bison_use_browser
This commit is contained in:
@@ -14,7 +14,9 @@ class PlugConfig(BaseModel):
|
||||
default=False,
|
||||
description="发送消息时将所有文本转换为图片,防止风控,仅需要推送文转图可以为 platform 指定 theme",
|
||||
)
|
||||
bison_theme_use_browser: bool = Field(default=False, description="是否允许主题使用浏览器")
|
||||
bison_use_browser: bool = Field(
|
||||
default=False, description="是否使用环境中的浏览器", alias="bison_theme_use_browser"
|
||||
)
|
||||
bison_init_filter: bool = True
|
||||
bison_use_queue: bool = True
|
||||
bison_outer_url: str = ""
|
||||
|
||||
@@ -11,7 +11,7 @@ class ThemeManager:
|
||||
logger.trace(f"Registering theme: {theme}")
|
||||
if theme.name in self.__themes:
|
||||
raise ThemeRegistrationError(f"Theme {theme.name} duplicated registration")
|
||||
if theme.need_browser and not plugin_config.bison_theme_use_browser:
|
||||
if theme.need_browser and not plugin_config.bison_use_browser:
|
||||
logger.opt(colors=True).warning(f"Theme <b><u>{theme.name}</u></b> requires browser, but not allowed")
|
||||
self.__themes[theme.name] = theme
|
||||
logger.opt(colors=True).success(f"Theme <b><u>{theme.name}</u></b> registered")
|
||||
|
||||
@@ -23,8 +23,8 @@ class Theme(ABC, BaseModel):
|
||||
|
||||
async def is_support_render(self, post: "AbstractPost") -> bool:
|
||||
"""是否支持渲染该类型的Post"""
|
||||
if self.need_browser and not plugin_config.bison_theme_use_browser:
|
||||
logger.warning(f"Theme {self.name} need browser, but `bison_theme_use_browser` is False")
|
||||
if self.need_browser and not plugin_config.bison_use_browser:
|
||||
logger.warning(f"Theme {self.name} need browser, but `bison_use_browser` is False")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user