mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-22 21:27:43 +08:00
feat: 支持天气
This commit is contained in:
parent
6a03003d41
commit
19308ffc53
@ -3,7 +3,7 @@ from nonebot.plugin import PluginMetadata
|
|||||||
from liteyuki.utils.language import get_default_lang
|
from liteyuki.utils.language import get_default_lang
|
||||||
from .core import *
|
from .core import *
|
||||||
from .loader import *
|
from .loader import *
|
||||||
from .webdash import *
|
from .runtime import *
|
||||||
|
|
||||||
__author__ = "snowykami"
|
__author__ = "snowykami"
|
||||||
__plugin_meta__ = PluginMetadata(
|
__plugin_meta__ = PluginMetadata(
|
||||||
|
@ -61,6 +61,14 @@ cmd_config = on_alconna(
|
|||||||
permission=SUPERUSER
|
permission=SUPERUSER
|
||||||
)
|
)
|
||||||
|
|
||||||
|
switch_image_mode = on_alconna(
|
||||||
|
aliases={"切换图片模式"},
|
||||||
|
command=Alconna(
|
||||||
|
"switch-image-mode"
|
||||||
|
),
|
||||||
|
permission=SUPERUSER
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@cmd_liteyuki.handle()
|
@cmd_liteyuki.handle()
|
||||||
async def _(bot: T_Bot):
|
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)
|
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
|
@driver.on_startup
|
||||||
async def on_startup():
|
async def on_startup():
|
||||||
htmlrender.browser = await htmlrender.get_browser()
|
htmlrender.browser = await htmlrender.get_browser()
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
|
|
||||||
from liteyuki.utils.data import LiteModel
|
from liteyuki.utils.data import LiteModel
|
||||||
|
|
||||||
|
|
||||||
|
class Location(LiteModel):
|
||||||
|
name: str = ""
|
||||||
|
id: str = ""
|
||||||
|
country: str = ""
|
||||||
|
|
||||||
class WeatherNow(LiteModel):
|
class WeatherNow(LiteModel):
|
||||||
time: str = ""
|
time: str = ""
|
||||||
city: str = ""
|
city: str = ""
|
Loading…
Reference in New Issue
Block a user