diff --git a/.github/workflows/update-cmdpriv-template.yml b/.github/workflows/update-cmdpriv-template.yml deleted file mode 100644 index 7493f332..00000000 --- a/.github/workflows/update-cmdpriv-template.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Update cmdpriv-template - -on: - push: - paths: - - 'pkg/qqbot/cmds/**' - pull_request: - types: [closed] - paths: - - 'pkg/qqbot/cmds/**' - -jobs: - update-cmdpriv-template: - if: github.event.pull_request.merged == true || github.event_name == 'push' - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.10.13 - - - name: Install dependencies - run: | - python -m pip install --upgrade yiri-mirai-rc openai>=1.0.0 colorlog func_timeout dulwich Pillow CallingGPT tiktoken - python -m pip install -U openai>=1.0.0 - - - name: Copy Scripts - run: | - cp res/scripts/generate_cmdpriv_template.py . - - - name: Generate Files - run: | - python main.py - - - name: Run generate_cmdpriv_template.py - run: python3 generate_cmdpriv_template.py - - - name: Check for changes in cmdpriv-template.json - id: check_changes - run: | - if git diff --name-only | grep -q "res/templates/cmdpriv-template.json"; then - echo "::set-output name=changes_detected::true" - else - echo "::set-output name=changes_detected::false" - fi - - - name: Commit changes to cmdpriv-template.json - if: steps.check_changes.outputs.changes_detected == 'true' - run: | - git config --global user.name "GitHub Actions Bot" - git config --global user.email "" - git add res/templates/cmdpriv-template.json - git commit -m "Update cmdpriv-template.json" - git push diff --git a/res/scripts/generate_cmdpriv_template.py b/res/scripts/generate_cmdpriv_template.py deleted file mode 100644 index f76f3c24..00000000 --- a/res/scripts/generate_cmdpriv_template.py +++ /dev/null @@ -1,17 +0,0 @@ -import pkg.qqbot.cmds.aamgr as cmdsmgr -import json - -# 执行命令模块的注册 -cmdsmgr.register_all() - -# 生成限权文件模板 -template: dict[str, int] = { - "comment": "以下为命令权限,请设置到cmdpriv.json中。关于此功能的说明,请查看:https://github.com/RockChinQ/QChatGPT/wiki/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8#%E5%91%BD%E4%BB%A4%E6%9D%83%E9%99%90%E6%8E%A7%E5%88%B6", -} - -for key in cmdsmgr.__command_list__: - template[key] = cmdsmgr.__command_list__[key]['privilege'] - -# 写入cmdpriv-template.json -with open('res/templates/cmdpriv-template.json', 'w') as f: - f.write(json.dumps(template, indent=4, ensure_ascii=False)) \ No newline at end of file