forked from SAGIRI-kawaii/saya_plugins_collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_demo.py
143 lines (140 loc) · 4.52 KB
/
config_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
from string import Template
# 和风天气配置
# https://dev.qweather.com/
KEY = "1324567890abcdefg"
CITY_URL = "https://geoapi.qweather.com/v2/city/lookup"
WEATHER_URL = "https://devapi.qweather.com/v7/weather/"
TIME = {
"当前": "now",
"现在": "now",
"24小时": "24h",
"今天": "24h",
"明天": "3d",
"后天": "3d",
"近三天": "3d",
"近七天": "7d"
}
MSG_TEMPLATE = {
"now": {
"text": Template(
"当前$city的天气为:\n"
"天气状况:$text\n"
"温度:$temp°C, 相对湿度:$humidity%, 体感温度:$feelsLike°C\n"
"风向:$windDir, 风力:$windScale级, 风速:$windSpeed km/h\n"
"当前小时累计降水量:$precip mm\n"
"气压:$pressure 百帕\n"
"能见度:$vis km\n"
"云量:$cloud%\n"
"观测时间:$obsTime\n"
"数据来源:$sources\n"
"版权:$license"
),
"textcard": Template(
"暂不支持卡片消息"
)
},
"24h": {
"text": Template(
"未来24小时内$city的天气情况为(时间倒序):\n"
"$hourly_data\n"
"数据来源:$sources\n"
"版权:$license"
),
"textcard": Template(
"暂不支持卡片消息"
)
},
"3d": {
"text": Template(
"$time$city的天气情况为:\n"
"$daily_data\n"
"数据来源:$sources\n"
"版权:$license"
),
"textcard": Template(
"暂不支持卡片消息"
)
},
"7d": {
"text": Template(
"$time$city的天气情况为(时间倒序):\n"
"$daily_data\n"
"数据来源:$sources\n"
"版权:$license"
),
"textcard": Template(
"暂不支持卡片消息"
)
}
}
HOURLY_DATA_TEMPLATE = Template(
"\n"
"时间: $fxTime\n"
"天气状况:$text\n"
"温度:$temp°C, 相对湿度:$humidity%\n"
"风向:$windDir, 风力:$windScale级, 风速:$windSpeed km/h\n"
"降水概率:$pop, 累计降水量:$precip mm\n"
"气压:$pressure 百帕\n"
"云量:$cloud%\n"
)
DAILY_DATA_TEMPLATE = Template(
"\n"
"时间: $fxDate\n"
"温度:$tempMax°C/$tempMin°C, 相对湿度:$humidity%\n"
"天气状况:白天$textDay, 夜间$textNight\n"
"风向:白天$windDirDay, 夜间$windDirNight\n"
"风力:白天$windScaleDay级, 夜间$windScaleNight级\n"
"风速:白天$windSpeedDay km/h, 夜间$windSpeedNight km/h\n"
"累计降水量:$precip mm\n"
"气压:$pressure 百帕\n"
"紫外线强度指数:$uvIndex\n"
"能见度:$vis\n"
"云量:$cloud%\n"
"日出:$sunrise, 日落:$sunset\n"
"月升:$moonrise, 月落:$moonset, 月相:$moonPhase\n"
)
SIMPLE_MSG_TEMPLATE = {
"now": {
"text": Template(
"$city: $text, 温度:$temp°C, 相对湿度:$humidity%, 体感温度:$feelsLike°C\n"
"数据来源:$sources, 版权:$license\n"
"发送地区+时间+\"详细天气\"查看详细天气,如:北京24小时详细天气预报"
),
"textcard": Template(
"暂不支持卡片消息"
)
},
"24h": {
"text": Template(
"未来24小时内$city的天气情况为:\n"
"$hourly_data"
"数据来源:$sources, 版权:$license\n"
"发送地区+时间+\"详细天气\"查看详细天气,如:北京24小时详细天气预报"
),
"textcard": Template("暂不支持卡片消息")
},
"3d": {
"text": Template(
"$time$city的天气情况为:\n"
"$daily_data"
"数据来源:$sources, 版权:$license\n"
"发送地区+时间+\"详细天气\"查看详细天气,如:北京24小时详细天气预报"
),
"textcard": Template("暂不支持卡片消息")
},
"7d": {
"text": Template(
"$time$city的天气情况为:\n"
"$daily_data"
"数据来源:$sources, 版权:$license\n"
"发送地区+时间+\"详细天气\"查看详细天气,如:北京24小时详细天气预报"
),
"textcard": Template("暂不支持卡片消息")
}
}
SIMPLE_HOURLY_DATA_TEMPLATE = Template(
"$fxTime: $text, 温度:$temp°C, 相对湿度:$humidity%\n"
)
SIMPLE_DAILY_DATA_TEMPLATE = Template(
"$fxDate: 白天$textDay, 夜间$textNight, 温度:$tempMax°C/$tempMin°C, 相对湿度:$humidity%\n"
)