mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-18 18:50:05 +08:00
update v0.0.5.0
This commit is contained in:
@@ -9,8 +9,14 @@ import nonebot
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
driver: Driver = nonebot.get_driver()
|
||||
|
||||
__zx_plugin_name__ = "更新扩展图库Omega [Hidden]"
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
|
||||
nonebot.load_plugins("plugins/pix_gallery")
|
||||
|
||||
driver: Driver = nonebot.get_driver()
|
||||
illust_url = f"{HIBIAPI}/api/pixiv/illust"
|
||||
|
||||
|
||||
@@ -27,11 +33,13 @@ async def _init_omega_pixiv_illusts():
|
||||
length = len([x for x in lines if "INSERT INTO" in x.upper()])
|
||||
all_pid = await OmegaPixivIllusts.get_all_pid()
|
||||
index = 0
|
||||
logger.info('检测到OmegaPixivIllusts数据库,准备开始更新....')
|
||||
logger.info("检测到OmegaPixivIllusts数据库,准备开始更新....")
|
||||
for line in lines:
|
||||
if "INSERT INTO" in line.upper():
|
||||
index += 1
|
||||
tasks.append(asyncio.ensure_future(_tasks(line, all_pid, length, index)))
|
||||
tasks.append(
|
||||
asyncio.ensure_future(_tasks(line, all_pid, length, index))
|
||||
)
|
||||
await asyncio.gather(*tasks)
|
||||
omega_pixiv_illusts.unlink()
|
||||
|
||||
@@ -45,12 +53,12 @@ async def _tasks(line: str, all_pid: List[int], length: int, index: int):
|
||||
x = data.split(maxsplit=3)
|
||||
pid = int(x[1][:-1].strip())
|
||||
if pid in all_pid:
|
||||
logger.info(f'添加OmegaPixivIllusts图库数据已存在 ---> pid:{pid}')
|
||||
logger.info(f"添加OmegaPixivIllusts图库数据已存在 ---> pid:{pid}")
|
||||
return
|
||||
uid = int(x[2][:-1].strip())
|
||||
x = x[3].split(", '")
|
||||
title = x[0].strip()[1:-1]
|
||||
tmp = x[1].split(', ')
|
||||
tmp = x[1].split(", ")
|
||||
author = tmp[0].strip()[:-1]
|
||||
nsfw_tag = int(tmp[1])
|
||||
width = int(tmp[2])
|
||||
@@ -68,9 +76,10 @@ async def _tasks(line: str, all_pid: List[int], length: int, index: int):
|
||||
nsfw_tag,
|
||||
tags,
|
||||
datetime.min,
|
||||
datetime.min
|
||||
datetime.min,
|
||||
):
|
||||
logger.info(f"成功添加OmegaPixivIllusts图库数据 pid:{pid} 本次预计存储 {length} 张,已更新第 {index} 张")
|
||||
logger.info(
|
||||
f"成功添加OmegaPixivIllusts图库数据 pid:{pid} 本次预计存储 {length} 张,已更新第 {index} 张"
|
||||
)
|
||||
else:
|
||||
logger.info(f"添加OmegaPixivIllusts图库数据已存在 ---> pid:{pid}")
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from nonebot.adapters.cqhttp import (
|
||||
GroupMessageEvent,
|
||||
PrivateMessageEvent,
|
||||
)
|
||||
from utils.static_data import withdraw_message_id_manager
|
||||
from utils.manager import withdraw_message_manager
|
||||
from nonebot.typing import T_State
|
||||
from .data_source import get_image
|
||||
from models.pixiv import Pixiv
|
||||
@@ -18,6 +18,40 @@ from nonebot import on_command
|
||||
import random
|
||||
|
||||
|
||||
__zx_plugin_name__ = "PIX"
|
||||
__plugin_usage__ = """
|
||||
usage:
|
||||
查看 pix 好康图库
|
||||
指令:
|
||||
pix ?*[tags]: 通过 tag 获取相似图片,不含tag时随机抽取
|
||||
pix pid[pid]: 查看图库中指定pid图片
|
||||
""".strip()
|
||||
__plugin_superuser_usage__ = """
|
||||
usage:
|
||||
超级用户额外的 pix 指令
|
||||
指令:
|
||||
pix -s ?*[tags]: 通过tag获取色图,不含tag时随机
|
||||
pix -r ?*[tags]: 通过tag获取r18图,不含tag时随机
|
||||
""".strip()
|
||||
__plugin_des__ = "这里是PIX图库!"
|
||||
__plugin_cmd__ = [
|
||||
"pix ?*[tags]",
|
||||
"pix pid [pid]",
|
||||
"pix -s ?*[tags] [_superuser]",
|
||||
"pix -r ?*[tags] [_superuser]",
|
||||
]
|
||||
__plugin_type__ = ("来点好康的",)
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
__plugin_settings__ = {
|
||||
"level": 5,
|
||||
"default_status": True,
|
||||
"limit_superuser": False,
|
||||
"cmd": ["pix", "Pix", "PIX", "pIx"],
|
||||
}
|
||||
__plugin_block_limit__ = {"rst": "您有PIX图片正在处理,请稍等..."}
|
||||
|
||||
|
||||
pix = on_command("pix", aliases={"PIX", "Pix"}, priority=5, block=True)
|
||||
|
||||
|
||||
@@ -46,16 +80,16 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
)
|
||||
else:
|
||||
x = keyword.split()
|
||||
if '-s' in x:
|
||||
x.remove('-s')
|
||||
if "-s" in x:
|
||||
x.remove("-s")
|
||||
nsfw_tag = 1
|
||||
elif '-r' in x:
|
||||
x.remove('-r')
|
||||
elif "-r" in x:
|
||||
x.remove("-r")
|
||||
nsfw_tag = 2
|
||||
else:
|
||||
nsfw_tag = 0
|
||||
if nsfw_tag != 0 and str(event.user_id) not in bot.config.superusers:
|
||||
await pix.finish('你不能看这些噢,这些都是是留给管理员看的...')
|
||||
await pix.finish("你不能看这些噢,这些都是是留给管理员看的...")
|
||||
if len(x) > 1:
|
||||
if is_number(x[-1]):
|
||||
num = int(x[-1])
|
||||
@@ -128,6 +162,4 @@ def withdraw_message(event: MessageEvent, id_: int):
|
||||
or (WITHDRAW_PIX_TIME[1] == 1 and isinstance(event, GroupMessageEvent))
|
||||
or WITHDRAW_PIX_TIME[1] == 2
|
||||
):
|
||||
withdraw_message_id_manager["message_id"].append(
|
||||
(id_, WITHDRAW_PIX_TIME[0])
|
||||
)
|
||||
withdraw_message_manager.append((id_, WITHDRAW_PIX_TIME[0]))
|
||||
|
||||
@@ -8,14 +8,19 @@ from models.pixiv_keyword_user import PixivKeywordUser
|
||||
from models.pixiv import Pixiv
|
||||
from nonebot.permission import SUPERUSER
|
||||
|
||||
__plugin_name__ = "添加PIX关键词/UID/PID | 添加PIX黑名单"
|
||||
|
||||
__zx_plugin_name__ = "PIX关键词/UID/PID添加管理 [Superuser]"
|
||||
__plugin_usage__ = """
|
||||
关键词:添加搜图的关键词(效果拉胯)
|
||||
UID:搜集该画师的图片,可指定收藏数
|
||||
PID:收录单张图片
|
||||
PIX黑名单:可以是当个pid,也可以是pid_p0等
|
||||
"""
|
||||
usage:
|
||||
PIX关键词/UID/PID添加管理操作
|
||||
指令:
|
||||
添加pix关键词 [Tag]: 添加一个pix搜索收录Tag
|
||||
添加pixuid [uid]: 添加一个pix搜索收录uid
|
||||
添加pixpid [pid]: 添加一个pix收录pid
|
||||
""".strip()
|
||||
__plugin_des__ = "PIX关键词/UID/PID添加管理"
|
||||
__plugin_cmd__ = ["添加pix关键词 [Tag]", "添加pixuid [uid]", "添加pixpid [pid]"]
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
|
||||
|
||||
add_keyword = on_command("添加pix关键词", aliases={"添加pix关键字"}, priority=1, block=True)
|
||||
|
||||
@@ -11,12 +11,29 @@ from models.pixiv_keyword_user import PixivKeywordUser
|
||||
from models.pixiv import Pixiv
|
||||
|
||||
|
||||
__plugin_name__ = "通过/取消/删除pix关键词 | 删除pix图片"
|
||||
|
||||
__zx_plugin_name__ = "PIX关键词/UID/PID删除管理 [Superuser]"
|
||||
__plugin_usage__ = """
|
||||
通过/取消/删除pix关键词 [关键词/pid/uid] 示例:通过pix关键词萝莉,通过pix关键词uid:123456,通过pix关键词pid:123456
|
||||
删除pix图片 *[pid] 示例:删除pix图片4223442
|
||||
"""
|
||||
usage:
|
||||
PIX关键词/UID/PID删除管理操作
|
||||
指令:
|
||||
通过pix关键词 [关键词/pid/uid]
|
||||
取消pix关键词 [关键词/pid/uid]
|
||||
删除pix关键词 [关键词/pid/uid]
|
||||
删除pix图片 *[pid]
|
||||
示例:通过pix关键词萝莉
|
||||
示例:通过pix关键词uid:123456
|
||||
示例:通过pix关键词pid:123456
|
||||
示例:删除pix图片4223442
|
||||
""".strip()
|
||||
__plugin_des__ = "PIX关键词/UID/PID删除管理"
|
||||
__plugin_cmd__ = [
|
||||
"通过pix关键词 [关键词/pid/uid]",
|
||||
"取消pix关键词 [关键词/pid/uid]",
|
||||
"删除pix关键词 [关键词/pid/uid]",
|
||||
"删除pix图片 *[pid]",
|
||||
]
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
|
||||
|
||||
pass_keyword = on_command(
|
||||
@@ -31,9 +48,7 @@ del_keyword = on_command(
|
||||
"删除pix关键词", aliases={"删除pix关键字"}, permission=SUPERUSER, priority=1, block=True
|
||||
)
|
||||
|
||||
del_pic = on_command(
|
||||
"删除pix图片", permission=SUPERUSER, priority=1, block=True
|
||||
)
|
||||
del_pic = on_command("删除pix图片", permission=SUPERUSER, priority=1, block=True)
|
||||
|
||||
|
||||
@del_keyword.handle()
|
||||
|
||||
@@ -7,11 +7,24 @@ from .data_source import gen_keyword_pic, get_keyword_num
|
||||
from models.pixiv_keyword_user import PixivKeywordUser
|
||||
import asyncio
|
||||
|
||||
__plugin_name__ = "查看pix图库"
|
||||
|
||||
__zx_plugin_name__ = "查看pix图库"
|
||||
__plugin_usage__ = """
|
||||
查看pix图库 [keyword]:当keyword为空时检查所有图片
|
||||
"""
|
||||
usage:
|
||||
查看pix图库
|
||||
指令:
|
||||
查看pix图库 ?[tags]: 查看指定tag图片数量,为空时查看整个图库
|
||||
""".strip()
|
||||
__plugin_des__ = "让我看看管理员私藏了多少货"
|
||||
__plugin_cmd__ = ["查看pix图库 ?[tags]"]
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
__plugin_settings__ = {
|
||||
"level": 5,
|
||||
"default_status": True,
|
||||
"limit_superuser": False,
|
||||
"cmd": ["查看pix图库"],
|
||||
}
|
||||
|
||||
|
||||
my_keyword = on_command("我的pix关键词", aliases={"我的pix关键字"}, priority=1, block=True)
|
||||
|
||||
@@ -9,14 +9,20 @@ from nonebot.adapters.cqhttp import Bot, MessageEvent
|
||||
import time
|
||||
|
||||
|
||||
__plugin_name__ = "更新pix关键字 | pix检查更新"
|
||||
|
||||
__zx_plugin_name__ = "pix检查更新 [Superuser]"
|
||||
__plugin_usage__ = """
|
||||
更新pix收录的所有或指定数量的关键词/uid/pid
|
||||
更新pix关键词 [keyword/uid/pid] [num]=all 示例:更新pix关键词uid 5
|
||||
pix检测更新:检测从未更新过的uid和pid
|
||||
"""
|
||||
|
||||
usage:
|
||||
更新pix收录的所有或指定数量的 关键词/uid/pid
|
||||
指令:
|
||||
更新pix关键词 *[keyword/uid/pid] [num=max]: 更新仅keyword/uid/pid或全部
|
||||
pix检测更新:检测从未更新过的uid和pid
|
||||
示例:更新pix关键词keyword
|
||||
示例:更新pix关键词uid 10
|
||||
""".strip()
|
||||
__plugin_des__ = "pix图库收录数据检查更新"
|
||||
__plugin_cmd__ = ["更新pix关键词 *[keyword/uid/pid] [num=max]", "pix检测更新"]
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
|
||||
start_update = on_command(
|
||||
"更新pix关键词", aliases={"更新pix关键字"}, permission=SUPERUSER, priority=1, block=True
|
||||
|
||||
Reference in New Issue
Block a user