mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-01-26 18:12:47 +08:00
✨ 重构 meogirl 模块,统一导入命名并添加类型忽略注释
This commit is contained in:
parent
5797381824
commit
8f5b05c51a
@ -1,16 +1,16 @@
|
||||
from . import mg_Info, mg_Introduce, mg_Search
|
||||
from . import mg_info, mg_introduce, mg_search
|
||||
|
||||
|
||||
# meogirl
|
||||
async def meogirl():
|
||||
return mg_Info.meogirl()
|
||||
return mg_info.meogirl()
|
||||
|
||||
|
||||
# Search
|
||||
async def search(msg: str, num: int = 3):
|
||||
return str(await mg_Search.search(msg, num))
|
||||
return str(await mg_search.search(msg, num))
|
||||
|
||||
|
||||
# Show
|
||||
async def introduce(msg: str):
|
||||
return str(await mg_Introduce.introduce(msg))
|
||||
return str(await mg_introduce.introduce(msg))
|
||||
|
@ -2,7 +2,7 @@ import re
|
||||
import urllib.parse
|
||||
|
||||
import httpx
|
||||
from bs4 import BeautifulSoup
|
||||
from bs4 import BeautifulSoup # type: ignore
|
||||
from nonebot.log import logger
|
||||
|
||||
headers = {
|
||||
@ -64,9 +64,9 @@ async def introduce(msg: str):
|
||||
elif response.status_code == 404:
|
||||
logger.info(f'未找到"{msg}", 进行搜索')
|
||||
|
||||
from . import mg_Search
|
||||
from . import mg_search
|
||||
|
||||
context = await mg_Search.search(msg, 1)
|
||||
context = await mg_search.search(msg, 1)
|
||||
keyword = re.search(r".*?\n", context, flags=re.DOTALL).group()[:-1] # type: ignore
|
||||
|
||||
logger.success(f'搜索完成, 打开"{keyword}"')
|
||||
|
@ -1,7 +1,7 @@
|
||||
import urllib.parse
|
||||
|
||||
import httpx
|
||||
from bs4 import BeautifulSoup
|
||||
from bs4 import BeautifulSoup # type: ignore
|
||||
from nonebot.log import logger
|
||||
|
||||
headers = {
|
||||
@ -76,9 +76,9 @@ async def search(msg: str, num: int):
|
||||
elif response.status_code == 302:
|
||||
logger.info(f'"{msg}"已被重定向至"{response.headers.get("location")}"')
|
||||
# 读取重定向结果
|
||||
from . import mg_Introduce
|
||||
from . import mg_introduce
|
||||
|
||||
return await mg_Introduce.introduce(msg)
|
||||
return await mg_introduce.introduce(msg)
|
||||
|
||||
else:
|
||||
logger.error(f"网络错误, 状态码 : {response.status_code}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user