diff --git a/liteyuki/liteyuki_main/__init__.py b/liteyuki/liteyuki_main/__init__.py index 6d147c61..1b20d380 100644 --- a/liteyuki/liteyuki_main/__init__.py +++ b/liteyuki/liteyuki_main/__init__.py @@ -3,7 +3,7 @@ from nonebot.plugin import PluginMetadata from liteyuki.utils.language import get_default_lang from .core import * from .loader import * -from .webdash import * +from .runtime import * __author__ = "snowykami" __plugin_meta__ = PluginMetadata( diff --git a/liteyuki/liteyuki_main/core.py b/liteyuki/liteyuki_main/core.py index 3817226f..1cb9986e 100644 --- a/liteyuki/liteyuki_main/core.py +++ b/liteyuki/liteyuki_main/core.py @@ -61,6 +61,14 @@ cmd_config = on_alconna( permission=SUPERUSER ) +switch_image_mode = on_alconna( + aliases={"切换图片模式"}, + command=Alconna( + "switch-image-mode" + ), + permission=SUPERUSER +) + @cmd_liteyuki.handle() async def _(bot: T_Bot): @@ -127,6 +135,14 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot): await md.send_md(reply, bot, event=event) +@switch_image_mode.handle() +async def _(bot: T_Bot, event: T_MessageEvent): + ulang = get_user_lang(str(event.user_id)) + stored_config: StoredConfig = common_db.first(StoredConfig(), default=StoredConfig()) + stored_config.config["markdown_image"] = not stored_config.config.get("markdownimage", False) + common_db.upsert(stored_config) + await switch_image_mode.finish(f"{ulang.get('liteyuki.image_mode_switched', MODE=ulang.get('liteyuki.image_mode_on') if stored_config.config.get('image_mode') else ulang.get('liteyuki.image_mode_off'))}") + @driver.on_startup async def on_startup(): htmlrender.browser = await htmlrender.get_browser() diff --git a/liteyuki/liteyuki_main/webdash.py b/liteyuki/liteyuki_main/runtime.py similarity index 100% rename from liteyuki/liteyuki_main/webdash.py rename to liteyuki/liteyuki_main/runtime.py diff --git a/liteyuki/plugins/liteyuki_weather/data_model.py b/liteyuki/plugins/liteyuki_weather/models.py similarity index 56% rename from liteyuki/plugins/liteyuki_weather/data_model.py rename to liteyuki/plugins/liteyuki_weather/models.py index 2558b966..3937f986 100644 --- a/liteyuki/plugins/liteyuki_weather/data_model.py +++ b/liteyuki/plugins/liteyuki_weather/models.py @@ -1,6 +1,12 @@ from liteyuki.utils.data import LiteModel + +class Location(LiteModel): + name: str = "" + id: str = "" + country: str = "" + class WeatherNow(LiteModel): time: str = "" city: str = ""