Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

版本更新 #1666

Merged
merged 73 commits into from
Sep 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
a368121
✨ 父级插件加载
HibiKier Aug 30, 2024
7e7436f
:white_check_mark: 添加测试:更新与添加插件 (#1594)
AkashiCoin Sep 1, 2024
8fe0617
🐛 bug修复
HibiKier Sep 1, 2024
29c4876
🐛修复添加插件返回403的问题 (#1595)
AkashiCoin Sep 1, 2024
15ad90d
🎨 修改readme
HibiKier Sep 2, 2024
db75c4a
Update README.md
HibiKier Sep 2, 2024
133d4e1
🐛 修改bug与版本锁定
HibiKier Sep 2, 2024
a56d1f2
🐛 修复超级用户对群组功能开关
HibiKier Sep 2, 2024
9eca6a9
🐛 修复插件商店检查插件更新问题 (#1597)
AkashiCoin Sep 2, 2024
44e0f2d
🐛 增加插件状态检查 (#1598)
AkashiCoin Sep 2, 2024
8d071f8
🐛 修复更新群组成员信息
HibiKier Sep 2, 2024
02aba68
🎨 代码优化
HibiKier Sep 2, 2024
405e2d3
:rocket: 更新Dockerfile (#1599)
fanyinrumeng Sep 2, 2024
a2549a0
🎨 更新requirements
HibiKier Sep 3, 2024
a619346
:heavy_plus_sign: 添加依赖aiocache
AkashiCoin Sep 3, 2024
8615eb2
:zap: 添加github镜像
AkashiCoin Sep 3, 2024
7288d5b
✨ 添加仓库目录多获取渠道
AkashiCoin Sep 3, 2024
8911bbf
🐛 修复测试用例
AkashiCoin Sep 3, 2024
c3927c7
✨ 添加API缓存
AkashiCoin Sep 3, 2024
682d19a
🎨 采取Sourcery建议
AkashiCoin Sep 3, 2024
ce97ded
🐛 文件下载逻辑修改
AkashiCoin Sep 3, 2024
c36bb97
🎨 优化代码
HibiKier Sep 4, 2024
51371ba
🐛 修复插件开关有时出现错误
HibiKier Sep 5, 2024
3b4c206
✨ 重构自检ui
HibiKier Sep 6, 2024
db9153f
🐛 自检html修正
HibiKier Sep 6, 2024
3f4787d
修复签到逻辑bug,并使代码更灵活以适应签到好感度等级配置 (#1606)
McElaga Sep 7, 2024
0a5ab83
🎨 代码结构优化
HibiKier Sep 7, 2024
807b2f6
🐛 私聊时修改插件时删除私聊帮助
HibiKier Sep 7, 2024
62fd93c
🐛 过滤父插件
HibiKier Sep 7, 2024
e618b19
🐛 修复自检在ARM上的问题 (#1607)
AkashiCoin Sep 7, 2024
057001f
✨ 支持mysql,psql,sqlite随机函数
HibiKier Sep 7, 2024
1790a0b
✨提供sqlite和mysql连接url示例
HibiKier Sep 7, 2024
2b006b8
:wrench: VSCode配置修改
AkashiCoin Sep 7, 2024
fe11ff0
:wrench: VSCode配置修改
AkashiCoin Sep 7, 2024
440e7b5
✨ 添加金币排行
AkashiCoin Sep 8, 2024
342e70c
:memo: 修改README
AkashiCoin Sep 8, 2024
f11e9c5
:hammer: 提取GitHub相关操作 (#1609)
AkashiCoin Sep 8, 2024
e4a92ea
✨ 签到/金币排行限制最大数量 (#1616)
HibiKier Sep 9, 2024
4e42d1d
🐛 修复超级用户id获取问题
HibiKier Sep 9, 2024
95762bd
🐛 修复路径解压与挂载 (#1619)
HibiKier Sep 10, 2024
a8355fb
🐛 修复功能少时zhenxun帮助图片排序问题 (#1620)
HibiKier Sep 11, 2024
94ef332
🐛 签到文本适应 (#1622)
HibiKier Sep 11, 2024
8a688eb
🐛 好感度排行提供默认值 (#1624)
HibiKier Sep 12, 2024
d97e437
🎈 优先使用github api (#1625)
AkashiCoin Sep 13, 2024
029a731
✨ 重构帮助,限制普通用户查询管理插件 (#1626)
HibiKier Sep 13, 2024
f1354c6
🐛 修复群权限与插件等级匹配 (#1627)
HibiKier Sep 14, 2024
f2e354e
✨ 当管理员尝试ban真寻时将被反杀 (#1628)
HibiKier Sep 14, 2024
e41e163
✨ 群组发言时间检测提供开关配置 (#1630)
HibiKier Sep 14, 2024
cd88d80
🐳 chore: 支持自动修改版本号 (#1629)
AkashiCoin Sep 16, 2024
51c010d
🎈 perf(github_utils): 支持github url下载遍历 (#1632)
AkashiCoin Sep 16, 2024
60f4406
🧪 test(auto_update): 修复测试用例 (#1633)
AkashiCoin Sep 16, 2024
fcfaf56
🐛 修复商店商品为空时报错 (#1634)
HibiKier Sep 16, 2024
6f635ed
🐛 修复群权限与插件等级匹配 (#1635)
HibiKier Sep 16, 2024
9832483
✨ message_build支持AtAll (#1639)
HibiKier Sep 19, 2024
f2c20b8
🎈 perf: 使用commit号下载插件 (#1641)
AkashiCoin Sep 21, 2024
3897658
🐳 chore: 修改运行检查触发路径 (#1642)
AkashiCoin Sep 21, 2024
a04475a
✨ 重构qq群事件处理 (#1643)
HibiKier Sep 21, 2024
3fc4eaa
🐛 签到名称自适应 (#1644)
HibiKier Sep 21, 2024
32c11b9
🎨 更新README (#1645)
HibiKier Sep 21, 2024
207f947
:bug: fix(http_utils): 流式下载Content-Length错误 (#1647)
AkashiCoin Sep 22, 2024
6be9e47
🐛 修复群组中帮助功能状态显示问题 (#1650)
HibiKier Sep 25, 2024
e89d1d4
🐛 修复群欢迎消息设置 (#1651)
HibiKier Sep 25, 2024
7ec1bc9
🐛 修复webui下载后首次启动错误 (#1652)
HibiKier Sep 25, 2024
b14220e
✨ 移除默认图片文件夹:爬 (#1653)
HibiKier Sep 27, 2024
7890cc5
✨ 安装/移除插件提供插件安装/卸载方法用于插件初始化 (#1654)
HibiKier Sep 27, 2024
28b61e5
✨ 新增超级用户与管理员帮助模板 (#1655)
HibiKier Sep 27, 2024
a3311ad
✨ 新增个人信息命令 (#1657)
HibiKier Sep 29, 2024
e8425f3
✨ 修改个人信息菜单名称 (#1658)
HibiKier Sep 29, 2024
d68a409
✨ 新增插件商店api (#1659)
HibiKier Sep 29, 2024
717a973
✨ 将cd,block,count限制复原配置文件 (#1662)
HibiKier Sep 30, 2024
2c8c46d
🎨 修改README (#1663)
HibiKier Sep 30, 2024
94e0594
🎨 修改版本号 (#1664)
HibiKier Sep 30, 2024
482eb1a
🎨 修改requirements (#1665)
HibiKier Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🎨 优化代码
HibiKier committed Sep 4, 2024
commit c36bb9771c1c7abeb8f8fef3b6b126011e6395c7
60 changes: 31 additions & 29 deletions zhenxun/builtin_plugins/record_request.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import time
from datetime import datetime

from nonebot.plugin import PluginMetadata
from nonebot import on_message, on_request
from nonebot_plugin_session import EventSession
from nonebot_plugin_apscheduler import scheduler
from nonebot.adapters.onebot.v11 import Bot as v11Bot
from nonebot.adapters.onebot.v12 import Bot as v12Bot
from nonebot.adapters.onebot.v11 import (
ActionFailed,
GroupRequestEvent,
FriendRequestEvent,
GroupRequestEvent,
)
from nonebot.adapters.onebot.v11 import Bot as v11Bot
from nonebot.adapters.onebot.v12 import Bot as v12Bot
from nonebot.plugin import PluginMetadata
from nonebot_plugin_apscheduler import scheduler
from nonebot_plugin_session import EventSession

from zhenxun.services.log import logger
from zhenxun.utils.message import MessageUtils
from zhenxun.configs.config import BotConfig, Config
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
from zhenxun.models.fg_request import FgRequest
from zhenxun.utils.platform import PlatformUtils
from zhenxun.models.friend_user import FriendUser
from zhenxun.configs.config import Config, BotConfig
from zhenxun.models.group_console import GroupConsole
from zhenxun.configs.utils import RegisterConfig, PluginExtraData
from zhenxun.utils.enum import PluginType, RequestType, RequestHandleType
from zhenxun.services.log import logger
from zhenxun.utils.enum import PluginType, RequestHandleType, RequestType
from zhenxun.utils.message import MessageUtils
from zhenxun.utils.platform import PlatformUtils

base_config = Config.get("invite_manager")

@@ -77,14 +77,6 @@ async def _(bot: v12Bot | v11Bot, event: FriendRequestEvent, session: EventSessi
# sex = user["sex"]
# age = str(user["age"])
comment = event.comment
if superuser:
await MessageUtils.build_message(
f"*****一份好友申请*****\n"
f"昵称:{nickname}({event.user_id})\n"
f"自动同意:{'√' if base_config.get('AUTO_ADD_FRIEND') else '×'}\n"
f"日期:{str(datetime.now()).split('.')[0]}\n"
f"备注:{event.comment}"
).send(target=PlatformUtils.get_target(bot, superuser))
if base_config.get("AUTO_ADD_FRIEND"):
logger.debug(
"已开启好友请求自动同意,成功通过该请求",
@@ -102,7 +94,7 @@ async def _(bot: v12Bot | v11Bot, event: FriendRequestEvent, session: EventSessi
user_id=str(event.user_id),
handle_type__isnull=True,
).update(handle_type=RequestHandleType.EXPIRE)
await FgRequest.create(
f = await FgRequest.create(
request_type=RequestType.FRIEND,
platform=session.platform,
bot_id=bot.self_id,
@@ -111,13 +103,22 @@ async def _(bot: v12Bot | v11Bot, event: FriendRequestEvent, session: EventSessi
nickname=nickname,
comment=comment,
)
if superuser:
await PlatformUtils.send_superuser(
bot,
f"*****一份好友申请*****\n"
f"ID: {f.id}"
f"昵称:{nickname}({event.user_id})\n"
f"自动同意:{'√' if base_config.get('AUTO_ADD_FRIEND') else '×'}\n"
f"日期:{str(datetime.now()).split('.')[0]}\n"
f"备注:{event.comment}",
)
else:
logger.debug("好友请求五分钟内重复, 已忽略", "好友请求", target=event.user_id)


@group_req.handle()
async def _(bot: v12Bot | v11Bot, event: GroupRequestEvent, session: EventSession):
superuser = BotConfig.get_superuser("qq")
if event.sub_type == "invite":
if str(event.user_id) in bot.config.superusers:
try:
@@ -168,12 +169,6 @@ async def _(bot: v12Bot | v11Bot, event: GroupRequestEvent, session: EventSessio
target=event.group_id,
)
nickname = await FriendUser.get_user_name(str(event.user_id))
await PlatformUtils.send_superuser(
bot,
f"*****一份入群申请*****\n申请人:{nickname}({event.user_id})\n群聊:"
f"{event.group_id}\n邀请日期:{datetime.now().replace(microsecond=0)}",
superuser,
)
await bot.send_private_msg(
user_id=event.user_id,
message=f"想要邀请我偷偷入群嘛~已经提醒{BotConfig.self_nickname}的管理员大人了\n"
@@ -187,7 +182,7 @@ async def _(bot: v12Bot | v11Bot, event: GroupRequestEvent, session: EventSessio
group_id=str(event.group_id),
handle_type__isnull=True,
).update(handle_type=RequestHandleType.EXPIRE)
await FgRequest.create(
f = await FgRequest.create(
request_type=RequestType.GROUP,
platform=session.platform,
bot_id=bot.self_id,
@@ -196,6 +191,13 @@ async def _(bot: v12Bot | v11Bot, event: GroupRequestEvent, session: EventSessio
nickname=nickname,
group_id=str(event.group_id),
)
await PlatformUtils.send_superuser(
bot,
f"*****一份入群申请*****\n"
"ID:{f.id}\n"
"申请人:{nickname}({event.user_id})\n群聊:"
f"{event.group_id}\n邀请日期:{datetime.now().replace(microsecond=0)}",
)
else:
logger.debug(
"群聊请求五分钟内重复, 已忽略",
8 changes: 4 additions & 4 deletions zhenxun/builtin_plugins/superuser/request_manage.py
Original file line number Diff line number Diff line change
@@ -224,8 +224,8 @@ async def _(
await _id_img.circle_corner(10)
await background.paste(_id_img, (10, 0), center_type="height")
img_list.append(background)
A = await BuildImage.auto_paste(img_list, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Potential performance improvement in image processing

The changes in this file seem to optimize the image processing logic. The removal of the BuildImage.auto_paste call and the addition of a check for non-empty img_list before processing could improve performance. However, ensure that this doesn't introduce any edge cases where an empty list might cause unexpected behavior.

if img_list:
    A = await BuildImage.auto_paste(img_list, 1)
    if A:
        # Further processing with A

if A:
if img_list:
A = await BuildImage.auto_paste(img_list, 1)
result_image = BuildImage(
A.width, A.height + 30, color=(255, 255, 255), font_size=20
)
@@ -237,8 +237,8 @@ async def _(
await MessageUtils.build_message("没有任何请求喔...").finish(reply_to=True)
if len(req_image_list) == 1:
await MessageUtils.build_message(req_image_list[0]).finish()
width = sum([img.width for img in req_image_list])
height = max([img.height for img in req_image_list])
width = sum(img.width for img in req_image_list)
height = max(img.height for img in req_image_list)
background = BuildImage(width, height)
await background.paste(req_image_list[0])
await req_image_list[1].line((0, 10, 1, req_image_list[1].height - 10), width=1)
18 changes: 9 additions & 9 deletions zhenxun/utils/platform.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import random
from collections.abc import Awaitable, Callable
from typing import Literal
from collections.abc import Callable, Awaitable

import httpx
import nonebot
from pydantic import BaseModel
from nonebot.adapters import Bot
from nonebot.utils import is_coroutine_callable
from nonebot.adapters.discord import Bot as DiscordBot
from nonebot.adapters.dodo import Bot as DodoBot
from nonebot.adapters.kaiheila import Bot as KaiheilaBot
from nonebot.adapters.onebot.v11 import Bot as v11Bot
from nonebot.adapters.onebot.v12 import Bot as v12Bot
from nonebot.adapters.discord import Bot as DiscordBot
from nonebot.adapters.kaiheila import Bot as KaiheilaBot
from nonebot_plugin_alconna.uniseg import Target, Receipt, UniMessage
from nonebot.utils import is_coroutine_callable
from nonebot_plugin_alconna.uniseg import Receipt, Target, UniMessage
from pydantic import BaseModel

from zhenxun.services.log import logger
from zhenxun.configs.config import BotConfig
from zhenxun.utils.message import MessageUtils
from zhenxun.models.friend_user import FriendUser
from zhenxun.utils.exception import NotFindSuperuser
from zhenxun.models.group_console import GroupConsole
from zhenxun.services.log import logger
from zhenxun.utils.exception import NotFindSuperuser
from zhenxun.utils.message import MessageUtils


class UserData(BaseModel):