pull/51/head
UnCLAS-Prommer 2025-07-07 16:49:07 +08:00
parent e2980305a5
commit ab9bd1c675
6 changed files with 12 additions and 8 deletions

View File

@ -57,4 +57,4 @@ Seg.data: Dict[str, Any] = {
} }
} }
``` ```
message_id怎么搞到手全凭你本事也请在自己的插件里写好确定是否能撤回对应的消息的功能毕竟这玩意真的单纯根据message_id撤消息 其中message_id是消息的实际qq_id于新版的mmc中可以从数据库获取如果工作正常的话

View File

@ -7,10 +7,12 @@ Seg.type = "notify"
Seg.data: Dict[str, Any] = { Seg.data: Dict[str, Any] = {
"sub_type": "ban", "sub_type": "ban",
"duration": "对应的禁言时间,单位为秒", "duration": "对应的禁言时间,单位为秒",
"banned_user_info": "被禁言的用户的信息为标准UserInfo对象" "banned_user_info": "被禁言的用户的信息为标准UserInfo转换成的字典"
} }
``` ```
此时`MessageBase.UserInfo`,即消息的`UserInfo`为操作者(operator)的信息 此时`MessageBase.UserInfo`,即消息的`UserInfo`为操作者(operator)的信息
**注意: `banned_user_info`需要自行调用`UserInfo.from_dict()`函数转换为标准UserInfo对象**
## 群聊开启全体禁言 ## 群聊开启全体禁言
```python ```python
Seg.data: Dict[str, Any] = { Seg.data: Dict[str, Any] = {
@ -30,6 +32,8 @@ Seg.data: Dict[str, Any] = {
**对于自然禁言解除的情况,此时`MessageBase.UserInfo`为`None`** **对于自然禁言解除的情况,此时`MessageBase.UserInfo`为`None`**
对于手动解除禁言的情况,此时`MessageBase.UserInfo`,即消息的`UserInfo`为操作者(operator)的信息 对于手动解除禁言的情况,此时`MessageBase.UserInfo`,即消息的`UserInfo`为操作者(operator)的信息
**注意: `lifted_user_info`需要自行调用`UserInfo.from_dict()`函数转换为标准UserInfo对象**
## 群聊关闭全体禁言 ## 群聊关闭全体禁言
```python ```python
Seg.data: Dict[str, Any] = { Seg.data: Dict[str, Any] = {

View File

@ -1,6 +1,6 @@
[project] [project]
name = "MaiBotNapcatAdapter" name = "MaiBotNapcatAdapter"
version = "0.4.2" version = "0.4.3"
description = "A MaiBot adapter for Napcat" description = "A MaiBot adapter for Napcat"
[tool.ruff] [tool.ruff]

View File

@ -21,4 +21,4 @@ class CommandType(Enum):
pyproject_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyproject.toml") pyproject_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyproject.toml")
toml_data = tomlkit.parse(open(pyproject_path, "r", encoding="utf-8").read()) toml_data = tomlkit.parse(open(pyproject_path, "r", encoding="utf-8").read())
version = toml_data["project"]["version"] version = toml_data["project"]["version"]
logger.info(f"版本\n\nMaiBot-Napcat-Adapter 版本: {version}\n喜欢的话点个star喵~\n") logger.info(f"版本\n\nMaiBot-Napcat-Adapter 版本: {version}\n喜欢的话点个star喵~\n")

View File

@ -60,7 +60,7 @@ def update_config():
# 创建备份文件夹 # 创建备份文件夹
backup_dir = "config_backup" backup_dir = "config_backup"
os.makedirs(backup_dir, exist_ok=True) os.makedirs(backup_dir, exist_ok=True)
# 备份文件名 # 备份文件名
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
old_backup_path = os.path.join(backup_dir, f"config.toml.bak.{timestamp}") old_backup_path = os.path.join(backup_dir, f"config.toml.bak.{timestamp}")

View File

@ -300,7 +300,7 @@ class NoticeHandler:
data={ data={
"sub_type": sub_type, "sub_type": sub_type,
"duration": duration, "duration": duration,
"banned_user_info": banned_user_info, "banned_user_info": banned_user_info.to_dict() if banned_user_info else None,
}, },
) )
@ -364,7 +364,7 @@ class NoticeHandler:
type="notify", type="notify",
data={ data={
"sub_type": sub_type, "sub_type": sub_type,
"lifted_user_info": lifted_user_info, "lifted_user_info": lifted_user_info.to_dict() if lifted_user_info else None,
}, },
) )
return seg_data, operator_info return seg_data, operator_info
@ -463,7 +463,7 @@ class NoticeHandler:
type="notify", type="notify",
data={ data={
"sub_type": "lift_ban", "sub_type": "lift_ban",
"lifted_user_info": lifted_user_info, "lifted_user_info": lifted_user_info.to_dict(),
}, },
) )