This commit is contained in:
hibiki
2021-08-04 15:19:45 +08:00
parent b62399e203
commit 910af434ae
22 changed files with 571 additions and 700 deletions
+3 -9
View File
@@ -1,10 +1,9 @@
from nonebot import on_regex
from .data_source import get_weather_of_city
from .data_source import get_weather_of_city, update_city, get_city_list
from nonebot.adapters.cqhttp import Bot, MessageEvent, GroupMessageEvent
from jieba import posseg
from services.log import logger
from nonebot.typing import T_State
from .config import city_list
import re
from utils.utils import get_message_text
@@ -26,14 +25,9 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
msg += "市"
city = ""
if msg:
citys = []
for x in city_list.keys():
for city in city_list[x]:
citys.append(city)
city_list = get_city_list()
for word in posseg.lcut(msg):
if word.word in city_list.keys():
await weather.finish("不要查一个省的天气啊,这么大查起来很累人的..", at_sender=True)
if word.flag == "ns" or word.word[:-1] in citys:
if word.flag == "ns" or word.word[:-1] in city_list:
city = str(word.word).strip()
break
if word.word == "火星":