更正私聊时功能管理回复错误

This commit is contained in:
HibiKier 2022-12-11 01:30:23 +08:00
parent 8adff43113
commit 940514b16b
5 changed files with 31 additions and 7 deletions

View File

@ -299,6 +299,7 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
### 2022/12/11
* 词条问题支持真寻的昵称开头与at真寻开头并优化回复
* 更正私聊时功能管理回复错误
* 添加统计表
### 2022/12/10

View File

@ -88,7 +88,7 @@ async def custom_group_welcome(
task_data = None
async def change_group_switch(cmd: str, group_id: int, is_super: bool = False):
async def change_group_switch(cmd: str, group_id: int, is_super: bool = False) -> str:
"""
说明:
修改群功能状态

View File

@ -85,7 +85,7 @@ async def _(bot: Bot, event: MessageEvent):
"group_name"
]
await switch_rule_matcher.send(
f"禁用群聊 {group_name}({block_type}) 的 {_cmd[2:]} 功能"
f"{_cmd[:2]}群聊 {group_name}({block_type}) 的 {_cmd[2:]} 功能"
)
elif block_type in ["all", "private", "group", "a", "p", "g"]:
block_type = "all" if block_type == "a" else block_type

View File

@ -136,7 +136,12 @@ class HelpImageBuild:
self._sort_data[plugin_data.menu_type[0]].append(self._data[key])
async def build_name_image(
self, max_width: int, name: str, color: str, text_color: Tuple[int, int, int], pos: Optional[Tuple[int, int, int, int]]
self,
max_width: int,
name: str,
color: str,
text_color: Tuple[int, int, int],
pos: Optional[Tuple[int, int, int, int]],
) -> BuildImage:
image = BuildImage(max_width - 5, 50, color=color, font_size=24)
await image.acircle_corner()
@ -160,7 +165,7 @@ class HelpImageBuild:
wh_list = [_image.getsize(x.name) for x in plugin_list]
wh_list.append(_image.getsize(menu_type))
# sum_height = sum([x[1] for x in wh_list])
if build_type == 'VV':
if build_type == "VV":
sum_height = 50 * len(plugin_list) + 10
else:
sum_height = (font_size + 6) * len(plugin_list) + 10
@ -192,7 +197,7 @@ class HelpImageBuild:
if (
not plugin_data.plugin_status.status
and plugin_data.plugin_status.block_type in ["group", "all"]
):
) or not group_manager.get_plugin_super_status(plugin_data.model, group_id):
w = curr_h + int(B.getsize(plugin_data.name)[1] / 2) + 2
pos = (
7,
@ -201,8 +206,16 @@ class HelpImageBuild:
w,
)
if build_type == "VV":
name_image = await self.build_name_image(max_width, plugin_data.name, "black" if not idx % 2 else "white", text_color, pos)
await B.apaste(name_image, (0, curr_h), True, center_type="by_width")
name_image = await self.build_name_image(
max_width,
plugin_data.name,
"black" if not idx % 2 else "white",
text_color,
pos,
)
await B.apaste(
name_image, (0, curr_h), True, center_type="by_width"
)
curr_h += name_image.h + 5
else:
await B.atext(

View File

@ -142,6 +142,16 @@ class GroupManager(StaticData):
"""
return module not in self._data.group_manager[str(group_id)].close_plugins
def get_plugin_super_status(self, module: str, group_id: int) -> bool:
"""
说明:
获取插件是否被超级用户关闭
参数:
:param module: 功能模块名
:param group_id: 群组
"""
return f"{module}:super" not in self._data.group_manager[str(group_id)].close_plugins
@init_group
def get_group_level(self, group_id: int) -> int:
"""