Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/advent259141/astrbot_self_manager_skill --skill config-manager명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
SOC 직업 분류 기준
| name | config-manager |
| description | 读取、搜索和修改 AstrBot 系统配置 |
| version | 2.0.0 |
| author | AstrBot Community |
| requires_admin | true |
| requires_computer_use | true |
管理 AstrBot 的系统配置。
async def get_config(context, key_path: str):
try:
config = context.get_astrbot_config()
keys = key_path.split(".")
value = config
for key in keys:
if isinstance(value, dict):
value = value.get(key)
else:
return f"❌ 配置路径「{key_path}」不存在。"
import json
return f"📋 配置「{key_path}」:\n```json\n{json.dumps(value, ensure_ascii=False, indent=2)}\n```"
except Exception as e:
return f"❌ 读取配置失败:{e}"
event = globals().get('event')
if not event.is_admin():
print("❌ 错误:仅管理员可用")
import sys; sys.exit(1)
context = globals().get('context')
result = await get_config(context, key_path="<配置路径>")
print(result)
async def search_config(context, keyword: str):
try:
config = context.get_astrbot_config()
def search_dict(d, prefix=""):
results = []
for k, v in d.items():
path = f"{prefix}.{k}" if prefix else k
if keyword.lower() in k.lower() or keyword.lower() in str(v).lower():
results.append((path, v))
if isinstance(v, dict):
results.extend(search_dict(v, path))
return results
matches = search_dict(config)
if not matches:
return f"🔍 没有找到包含「{keyword}」的配置项。"
lines = [f"🔍 找到 {len(matches)} 个匹配项:\n"]
for path, value in matches[:20]: # 最多显示20个
value_str = str(value)[:50]
lines.append(f"- **{path}**: {value_str}")
if len(matches) > 20:
lines.append(f"\n...还有 个结果")
.join(lines)
Exception e:
result = search_config(context, keyword=)
(result)
async def set_config(context, updates: dict):
try:
config = context.get_astrbot_config()
old_config = config.copy()
# 应用更新
for key_path, new_value in updates.items():
keys = key_path.split(".")
target = config
for key in keys[:-1]:
if key not in target:
target[key] = {}
target = target[key]
# 类型推断
old_value = target.get(keys[-1])
if old_value is not None:
if isinstance(old_value, bool):
new_value = str(new_value).lower() in ["true", "1", "yes"]
elif isinstance(old_value, int):
new_value = int(new_value)
elif isinstance(old_value, float):
new_value = float(new_value)
target[keys[-1]] = new_value
# 保存配置
try:
context.save_astrbot_config(config)
except Exception as e:
# 回滚
context.save_astrbot_config(old_config)
lines = []
key_path, new_value updates.items():
lines.append()
.join(lines)
Exception e:
result = set_config(context, updates={
: ,
})
(result)