Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
16c81a4
feat: 将kook适配器插件并入astrbot官方适配器目录中
shuiping233 Mar 2, 2026
864a881
refactor: 重命名函数名为 _warp_message
shuiping233 Mar 2, 2026
fd9b6a6
refactor: 使用Protocol替换Union类型
shuiping233 Mar 2, 2026
2b3c86c
bugfix: 修复base64前缀处理问题
shuiping233 Mar 2, 2026
33a2f5d
refactor: 抛出的错误不再包含"[kook]"
shuiping233 Mar 2, 2026
162aab0
refactor: 添加读取本地文件时的路径安全检查
shuiping233 Mar 2, 2026
6f3172c
refactor: 卡片消息解析失败时会打印错误信息
shuiping233 Mar 2, 2026
5a3f2d1
refactor: 添加处理接收卡片消息内的图片url时的安全校验
shuiping233 Mar 2, 2026
deaa162
refactor: 安全处理ws需要重连的情况
shuiping233 Mar 2, 2026
e22914c
Revert "refactor: 使用Protocol替换Union类型"
shuiping233 Mar 2, 2026
91dc1ad
feat: 添加获取机器人名称的实现
shuiping233 Mar 2, 2026
8de9b26
refactor: 让send_by_session发送主动消息时正确传入当前消息链的文本消息内容
shuiping233 Mar 2, 2026
88c1e6d
refactor: 统一处理适配器配置相关内容,处理仪表盘出传入配置,并添加仪表盘的kook适配器配置页面的i18n文本
shuiping233 Mar 2, 2026
a96d819
unittest: 添加kook适配器的单元测试,虽然没覆盖多少单测
shuiping233 Mar 2, 2026
c556240
unittest: TEST_DATA_DIR用更安全的路径
shuiping233 Mar 2, 2026
68402f5
refactor: KookConfig使用了更好的默认值处理方式
shuiping233 Mar 2, 2026
ce88a8b
refactor: 移除kook_adapter 的config字段重复定义
shuiping233 Mar 2, 2026
64ebec5
refactor: 隐藏获取kook gateway时url里的token,防止把token打印出来
shuiping233 Mar 2, 2026
55ce048
refactor: KookConfig.pretty_jsons使用*来屏蔽token内容
shuiping233 Mar 2, 2026
36f2f6c
bugfix: 修复主动发送消息时,调用了父方法`send_by_session`可能导致指标被重复上传的bug
shuiping233 Mar 2, 2026
07b3840
refactor: 优化upload_asset的路径处理报错
shuiping233 Mar 2, 2026
831afca
bugfix: 修复kook ws心跳间隔可能会出现负数时间的bug
shuiping233 Mar 2, 2026
aacc2a1
refactor: KookClient移到KookPlatformAdapter.__init__里初始化
shuiping233 Mar 2, 2026
c5be9d3
bugfix: 修复处理base64 url 多替换了/而报错的bug
shuiping233 Mar 2, 2026
cb2d83a
refactor: kook适配器上传文件失败时,会抛出错误
shuiping233 Mar 2, 2026
dace3f0
chore: 移除一条注释
shuiping233 Mar 2, 2026
6c245c0
refactor: 移除没用的return
shuiping233 Mar 2, 2026
9a95607
refactor: 即使消息链中有消息发送失败了,也尽可能将其他消息发送出去,并把报错信息也发送出去
shuiping233 Mar 2, 2026
1ee409b
refactor: 增强上传任务失败时的错误处理,使其发生错误时尽力而为发送其余消息
shuiping233 Mar 2, 2026
3e17643
refactor: 发送到消息频道的报错消息加了个⚠️,小巧思这块?
shuiping233 Mar 2, 2026
e72aa75
refactor: 咱们在写适配器啊,要什么小巧思呢,小巧思给上游插件开发弄不好么)
shuiping233 Mar 2, 2026
d7d6f79
Merge remote-tracking branch 'origin/master' into feat/astrbot_plugin…
Soulter Mar 3, 2026
86e5eaf
refactor: enhance Kook adapter with kmarkdown parsing and improve fil…
Soulter Mar 3, 2026
877f591
refactor: extract card message parsing logic into a separate method
Soulter Mar 3, 2026
04292fd
feat: add kook_bot_nickname configuration to ignore messages from spe…
Soulter Mar 3, 2026
a63fa83
refactor: remove commented-out code and clean up file upload error ha…
Soulter Mar 3, 2026
e6ba594
fix: remove redundant prefix handling for file URLs in asset upload
Soulter Mar 3, 2026
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
59 changes: 59 additions & 0 deletions astrbot/core/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,20 @@ class ChatProviderTemplate(TypedDict):
"satori_heartbeat_interval": 10,
"satori_reconnect_delay": 5,
},
"kook": {
"id": "kook",
"type": "kook",
"enable": False,
"kook_bot_token": "",
"kook_bot_nickname": "",
"kook_reconnect_delay": 1,
"kook_max_reconnect_delay": 60,
"kook_max_retry_delay": 60,
"kook_heartbeat_interval": 30,
"kook_heartbeat_timeout": 6,
"kook_max_heartbeat_failures": 3,
"kook_max_consecutive_failures": 5,
},
# "WebChat": {
# "id": "webchat",
# "type": "webchat",
Expand Down Expand Up @@ -790,6 +804,51 @@ class ChatProviderTemplate(TypedDict):
"type": "string",
"hint": "统一 Webhook 模式下的唯一标识符,创建平台时自动生成。",
},
"kook_bot_token": {
"description": "机器人 Token",
"type": "string",
"hint": "必填项。从 KOOK 开发者平台获取的机器人 Token。",
},
"kook_bot_nickname": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

机器人的名字要修改的话应该是在kook机器人控制台里改的,KookClient里有个get_bot_info能通过kook接口拿到自身bot_idbot_name,我不知道为什么明明我拿了bot_name却没拿来用上,但是有bot_name的话应该就不用用户手动填kook_bot_nickname进来了吧,也省的用户改了kook那边机器人名称,但是忘了改kook适配器配置)

"description": "Bot Nickname",
"type": "string",
"hint": "可选项。若发送者昵称与此值一致,将忽略该消息以避免广播风暴。",
},
"kook_reconnect_delay": {
"description": "重连延迟",
"type": "int",
"hint": "重连延迟时间(秒),使用指数退避策略。",
},
"kook_max_reconnect_delay": {
"description": "最大重连延迟",
"type": "int",
"hint": "重连延迟的最大值(秒)。",
},
"kook_max_retry_delay": {
"description": "最大重试延迟",
"type": "int",
"hint": "重试的最大延迟时间(秒)。",
},
"kook_heartbeat_interval": {
"description": "心跳间隔",
"type": "int",
"hint": "心跳检测间隔时间(秒)。",
},
"kook_heartbeat_timeout": {
"description": "心跳超时时间",
"type": "int",
"hint": "心跳检测超时时间(秒)。",
},
"kook_max_heartbeat_failures": {
"description": "最大心跳失败次数",
"type": "int",
"hint": "允许的最大心跳失败次数,超过后断开连接。",
},
"kook_max_consecutive_failures": {
"description": "最大连续失败次数",
"type": "int",
"hint": "允许的最大连续失败次数,超过后停止重试。",
},
},
},
"platform_settings": {
Expand Down
4 changes: 4 additions & 0 deletions astrbot/core/platform/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ async def load_platform(self, platform_config: dict) -> None:
from .sources.line.line_adapter import (
LinePlatformAdapter, # noqa: F401
)
case "kook":
from .sources.kook.kook_adapter import (
KookPlatformAdapter, # noqa: F401
)
except (ImportError, ModuleNotFoundError) as e:
logger.error(
f"加载平台适配器 {platform_config['type']} 失败,原因:{e}。请检查依赖库是否安装。提示:可以在 管理面板->平台日志->安装Pip库 中安装依赖库。",
Expand Down
Loading