mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-15 17:20:01 +08:00
🐛 修复群欢迎消息删除问题 (#1864)
* 🐛 修复群欢迎消息删除问题 * 🩹 优化笨蛋检测和修复商店图标问题 * 🎨 笨蛋检测更多规则移入rule * 🎨 优化我的道具方法
This commit is contained in:
@@ -5,6 +5,8 @@ from nonebot_plugin_session import EventSession
|
||||
from nonebot_plugin_uninfo import Uninfo
|
||||
|
||||
from zhenxun.configs.config import Config
|
||||
from zhenxun.models.ban_console import BanConsole
|
||||
from zhenxun.models.group_console import GroupConsole
|
||||
from zhenxun.models.level_user import LevelUser
|
||||
from zhenxun.utils.platform import PlatformUtils
|
||||
|
||||
@@ -89,3 +91,21 @@ def notice_rule(event_type: type | list[type]) -> Rule:
|
||||
return False
|
||||
|
||||
return Rule(_rule)
|
||||
|
||||
|
||||
def is_allowed_call() -> Rule:
|
||||
"""是否允许调用插件"""
|
||||
|
||||
async def _rule(session: Uninfo) -> bool:
|
||||
group_id = session.group.id if session.group else None
|
||||
if await BanConsole.is_ban(session.user.id, group_id):
|
||||
return False
|
||||
if group_id:
|
||||
if await BanConsole.is_ban(None, group_id):
|
||||
return False
|
||||
if g := await GroupConsole.get_group(group_id):
|
||||
if g.level < 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
return Rule(_rule)
|
||||
|
||||
Reference in New Issue
Block a user