mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-22 12:40:09 +08:00
update v0.0.5.0
This commit is contained in:
@@ -4,17 +4,32 @@ from services.log import logger
|
||||
from nonebot.adapters.cqhttp import Bot, MessageEvent, GroupMessageEvent
|
||||
from nonebot.typing import T_State
|
||||
from configs.config import MAXINFO_GROUP_ANIME, MAXINFO_PRIVATE_ANIME
|
||||
from utils.utils import get_message_text, UserExistLimiter
|
||||
from utils.utils import get_message_text
|
||||
|
||||
|
||||
__plugin_name__ = "搜番"
|
||||
__plugin_usage__ = r"""
|
||||
在群内使用此功能只返还5个结果,私聊返还 20 个结果(绝不能打扰老色批们看色图!)
|
||||
搜索动漫资源
|
||||
搜番 [番剧名称或者关键词]
|
||||
搜番 Aria
|
||||
__zx_plugin_name__ = "搜番"
|
||||
__plugin_usage__ = f"""
|
||||
usage:
|
||||
搜索动漫资源
|
||||
普通的搜番群内使用此功能只返还 {MAXINFO_GROUP_ANIME} 个结果,私聊返还 {MAXINFO_PRIVATE_ANIME} 个结果(绝不能打扰老色批们看色图!)
|
||||
指令:
|
||||
搜番 [番剧名称或者关键词]
|
||||
示例:搜番 刀剑神域
|
||||
""".strip()
|
||||
_ulmt = UserExistLimiter()
|
||||
__plugin_des__ = "找不到想看的动漫吗?"
|
||||
__plugin_cmd__ = ["搜番 [番剧名称或者关键词]"]
|
||||
__plugin_type__ = ("一些工具",)
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
__plugin_settings__ = {
|
||||
"level": 5,
|
||||
"default_status": True,
|
||||
"limit_superuser": False,
|
||||
"cmd": ["搜番"],
|
||||
}
|
||||
__plugin_block_limit__ = {
|
||||
"rst": "搜索还未完成,不要重复触发!"
|
||||
}
|
||||
|
||||
search_anime = on_command("搜番", aliases={"搜动漫"}, priority=5, block=True)
|
||||
|
||||
@@ -29,9 +44,6 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
|
||||
@search_anime.handle()
|
||||
async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
if _ulmt.check(event.user_id):
|
||||
await search_anime.finish("您有动漫正在搜索,请稍等...", at_sender=True)
|
||||
_ulmt.set_true(event.user_id)
|
||||
if get_message_text(event.json()):
|
||||
state["anime"] = get_message_text(event.json())
|
||||
|
||||
@@ -55,4 +67,3 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
else:
|
||||
logger.warning(f"未找到番剧 {key_word}")
|
||||
await search_anime.send(f"未找到番剧 {key_word}(也有可能是超时,再尝试一下?)")
|
||||
_ulmt.set_false(event.user_id)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from lxml import etree
|
||||
from lxml import etree
|
||||
import feedparser
|
||||
from urllib import parse
|
||||
from services.log import logger
|
||||
@@ -13,7 +12,6 @@ async def from_anime_get_info(key_word: str, max_: int) -> str:
|
||||
repass = ""
|
||||
url = "https://share.dmhy.org/topics/rss/rss.xml?keyword=" + parse.quote(key_word)
|
||||
try:
|
||||
logger.debug("Now starting get the {}".format(url))
|
||||
repass = await get_repass(url, max_)
|
||||
except Exception as e:
|
||||
logger.error("Timeout! {}".format(e))
|
||||
@@ -28,7 +26,6 @@ async def get_repass(url: str, max_: int) -> str:
|
||||
d = feedparser.parse(await response.text())
|
||||
url_list = [e.link for e in d.entries][:max_]
|
||||
for u in url_list:
|
||||
print(u)
|
||||
try:
|
||||
async with session.get(
|
||||
u, proxy=get_local_proxy(), timeout=20
|
||||
@@ -47,7 +44,6 @@ async def get_repass(url: str, max_: int) -> str:
|
||||
.replace("\t", "")
|
||||
)
|
||||
size = item[3].xpath("string(.)")[5:].strip()
|
||||
|
||||
putline.append(
|
||||
"【{}】| {}\n【{}】| {}".format(class_a, title, size, magent)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user