This commit is contained in:
HibiKier
2022-05-21 13:15:53 +08:00
parent 86a8fe7096
commit 188ae38525
25 changed files with 153 additions and 124 deletions
+2
View File
@@ -49,6 +49,8 @@ async def _(bot: Bot, event: MessageEvent, state: T_State, key_word: str = ArgSt
Config.get_config("search_anime", "SEARCH_ANIME_MAX_INFO"),
)
if anime_report:
if isinstance(anime_report, str):
await search_anime.finish(anime_report)
if isinstance(event, GroupMessageEvent):
mes_list = custom_forward_msg(anime_report, bot.self_id)
await bot.send_group_forward_msg(group_id=event.group_id, messages=mes_list)
+4 -4
View File
@@ -3,18 +3,18 @@ import feedparser
from urllib import parse
from services.log import logger
from utils.http_utils import AsyncHttpx
from typing import List
from typing import List, Union
import time
async def from_anime_get_info(key_word: str, max_: int) -> List[str]:
async def from_anime_get_info(key_word: str, max_: int) -> Union[str, List[str]]:
s_time = time.time()
repass = ""
url = "https://share.dmhy.org/topics/rss/rss.xml?keyword=" + parse.quote(key_word)
try:
repass = await get_repass(url, max_)
except Exception as e:
logger.error("Timeout! {}".format(e))
logger.error(f"发生了一些错误 {type(e)}:{e}")
return "发生了一些错误!"
repass.insert(0, f"搜索 {key_word} 结果(耗时 {int(time.time() - s_time)} 秒):\n")
return repass