feat: 重启时间显示

This commit is contained in:
2024-04-10 23:47:10 +08:00
parent db0542279b
commit 38f658edf9
6 changed files with 111 additions and 55 deletions

View File

@ -5,36 +5,48 @@ from liteyuki.utils.data import LiteModel
class Location(LiteModel):
name: str = ""
id: str = ""
lat: str = ""
lon: str = ""
adm2: str = ""
adm1: str = ""
country: str = ""
tz: str = ""
utcOffset: str = ""
isDst: str = ""
type: str = ""
rank: str = ""
fxLink: str = ""
sources: str = ""
license: str = ""
class CityLookupResponse(LiteModel):
code: str = ""
location: Location = Location()
class WeatherNow(LiteModel):
time: str = ""
city: str = ""
obsTime: str = ""
temp: str = ""
feelsLike: str = ""
icon: str = ""
text: str = ""
wind360: str = ""
windDir: str = ""
windScale: str = ""
windSpeed: str = ""
humidity: str = ""
precip: str = ""
pressure: str = ""
vis: str = ""
cloud: str = ""
dew: str = ""
sources: str = ""
license: str = ""
weather = on_command("weather", aliases={"天气", "查天气", "天气预报", "查天气预报"})
weather_now = on_command("weather_now", aliases={"实时天气", "查实时天气", "实时天气预报", "查实时天气预报"})
weather_forecast = on_command("weather_forecast", aliases={"天气预报", "查天气预报", "未来天气", "查未来天气"})
weather_warning = on_command("weather_warning", aliases={"天气预警", "查天气预警", "天气警告", "查天气警告"})
weather_life = on_command("weather_life", aliases={"生活指数", "查生活指数", "生活指数预报", "查生活指数预报"})
weather_air = on_command("weather_air", aliases={"空气质量", "查空气质量", "空气质量预报", "查空气质量预报"})
weather_rain = on_command("weather_rain", aliases={"降雨预报", "查降雨预报", "降雨量", "查降雨量"})
weather_snow = on_command("weather_snow", aliases={"降雪预报", "查降雪预报", "降雪量", "查降雪量"})
@weather.handle()
async def handle_weather(bot, event):
args = str(event.get_message()).strip()
if not args:
await weather.finish("请输入要查询的城市")
else:
pass
@weather_now.handle()
async def handle_weather_now(bot, event):
pass
@weather_forecast.handle()
async def handle_weather_forecast(bot, event):
pass
class WeatherNowResponse(LiteModel):
code: str = ""
updateTime: str = ""
fxLink: str = ""
now: WeatherNow = WeatherNow()

View File

@ -0,0 +1,15 @@
from nonebot import require
require("nonebot_plugin_alconna")
from nonebot_plugin_alconna import on_alconna, Alconna, Subcommand, Args, MultiVar, Arparma
@on_alconna(
aliases={"天气"},
command=Alconna(
"weather",
Args["keywords", MultiVar(str)],
),
).handle()
async def _(result: Arparma):
"""await alconna.send("weather", city)"""