nonebot-plugin-system-command


Namenonebot-plugin-system-command JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/tkgs0/nonebot-plugin-system-command
SummaryCall the system command in NoneBot2
upload_time2024-07-27 05:24:43
maintainerNone
docs_urlNone
author月ヶ瀬
requires_python<4.0,>=3.9
licenseMIT
keywords nonebot nonebot2 nonebot_plugin system shell cmd powershell
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <a href="https://v2.nonebot.dev/store"><img src="https://raw.githubusercontent.com/tkgs0/nbpt/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
  <br>
  <p><img src="https://raw.githubusercontent.com/tkgs0/nbpt/resources/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText"></p>
</div>

<div align="center">

# nonebot-plugin-system-command

_✨ Call the system command-line in NoneBot2 ✨_

<a href="./LICENSE">
    <img src="https://img.shields.io/github/license/tkgs0/nonebot-plugin-system-command.svg" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot-plugin-system-command">
    <img src="https://img.shields.io/pypi/v/nonebot-plugin-system-command.svg" alt="pypi">
</a>
<a href="https://www.python.org">
    <img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
</a>
<a href="https://nonebot.dev">
    <img src="https://img.shields.io/badge/nonebot-2.3.1+-red.svg" alt="nonebot">
</a>

</div>

- 以发送消息的方式操作Bot所在环境的系统命令行
- 甚至可以通过此插件 `rm` 整个服务器
- 限超级用户使用

## 💿 安装

**nb-cli安装, 包管理器安装  二选一**

<details>
<summary>使用 nb-cli 安装</summary>

在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装

    nb plugin install nonebot-plugin-system-command

</details>

<details>
<summary>使用包管理器安装</summary>

在 nonebot2 项目的插件目录下, 打开命令行,

**根据你使用的包管理器, 输入相应的安装命令**

<details>
<summary>pip</summary>

    pip install nonebot-plugin-system-command

</details>
<details>
<summary>pdm</summary>

    pdm add nonebot-plugin-system-command

</details>
<details>
<summary>poetry</summary>

    poetry add nonebot-plugin-system-command

</details>
<details>
<summary>conda</summary>

    conda install nonebot-plugin-system-command

</details>

打开 bot项目下的 `pyproject.toml` 文件,

在其 `plugins` 里加入 `nonebot_plugin_system_command`

    plugins = ["nonebot_plugin_system_command"]

</details>
</details>

## 🎉 使用

- 可在 Bot项目的 `.env*` 中自定义调用命令行的指令,
  默认值为 `/sh` 和 `/cmd`

- 如果 `.env*` 中 `COMMAND_START` 变量值为 `["/"]`
  那么指令应该为 `//sh` `//cmd`

```env
SYS_CMD_SH="/sh"
SYS_CMD_CMD="/cmd"
```

### 指令表

<table> 
  <tr align="center">
    <th> 指令 </th>
    <th> 权限 </th>
    <th> 需要@ </th>
    <th> 范围 </th>
    <th> 特性 </th>
    <th> 说明 </th>
  </tr>
  <tr align="center">
    <td> /sh </td>
    <td> 主人 </td>
    <td> 否 </td>
    <td> 私聊 | 群聊 </td>
    <td> 异步管道 </td>
    <td> Windows环境无法正常使用 </td>
  </tr>
  <tr align="center">
    <td> /cmd </td>
    <td> 主人 </td>
    <td> 否 </td>
    <td> 私聊 | 群聊 </td>
    <td> 同步管道 </td>
    <td> 通用 </td>
  </tr>
</table>

### 语法

命令行语法与Bot运行环境相关, 与插件指令无关, `linux-shell` 运行即使用 `linux-shell` 语法, `cmd` 运行即使用 `cmd` 语法, `powershell` 运行即使用 `powershell` 语法

### ⚠️ ATTENTION!!

自定义指令前请三思而后行, 确保本插件不会因为响应了不相干的消息, 导致设备遭受灾难性的损坏!

### 示例

```
/sh echo "hello world"
```

```
/cmd echo "hello world"
```

## TODO

- [x] 使用异步管道
- [ ] 命令行交互

## ⚠️ ATTENTION!!!

Don't drink and root!


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tkgs0/nonebot-plugin-system-command",
    "name": "nonebot-plugin-system-command",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "nonebot, nonebot2, nonebot_plugin, system, shell, cmd, powershell",
    "author": "\u6708\u30f6\u702c",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/35/84/8fe2d5577fbd4ba393a3d53d831ae5d6d86df86a921d5fc4bbe70c0a1767/nonebot_plugin_system_command-0.1.2.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <a href=\"https://v2.nonebot.dev/store\"><img src=\"https://raw.githubusercontent.com/tkgs0/nbpt/resources/nbp_logo.png\" width=\"180\" height=\"180\" alt=\"NoneBotPluginLogo\"></a>\n  <br>\n  <p><img src=\"https://raw.githubusercontent.com/tkgs0/nbpt/resources/NoneBotPlugin.svg\" width=\"240\" alt=\"NoneBotPluginText\"></p>\n</div>\n\n<div align=\"center\">\n\n# nonebot-plugin-system-command\n\n_\u2728 Call the system command-line in NoneBot2 \u2728_\n\n<a href=\"./LICENSE\">\n    <img src=\"https://img.shields.io/github/license/tkgs0/nonebot-plugin-system-command.svg\" alt=\"license\">\n</a>\n<a href=\"https://pypi.python.org/pypi/nonebot-plugin-system-command\">\n    <img src=\"https://img.shields.io/pypi/v/nonebot-plugin-system-command.svg\" alt=\"pypi\">\n</a>\n<a href=\"https://www.python.org\">\n    <img src=\"https://img.shields.io/badge/python-3.9+-blue.svg\" alt=\"python\">\n</a>\n<a href=\"https://nonebot.dev\">\n    <img src=\"https://img.shields.io/badge/nonebot-2.3.1+-red.svg\" alt=\"nonebot\">\n</a>\n\n</div>\n\n- \u4ee5\u53d1\u9001\u6d88\u606f\u7684\u65b9\u5f0f\u64cd\u4f5cBot\u6240\u5728\u73af\u5883\u7684\u7cfb\u7edf\u547d\u4ee4\u884c\n- \u751a\u81f3\u53ef\u4ee5\u901a\u8fc7\u6b64\u63d2\u4ef6 `rm` \u6574\u4e2a\u670d\u52a1\u5668\n- \u9650\u8d85\u7ea7\u7528\u6237\u4f7f\u7528\n\n## \ud83d\udcbf \u5b89\u88c5\n\n**nb-cli\u5b89\u88c5, \u5305\u7ba1\u7406\u5668\u5b89\u88c5  \u4e8c\u9009\u4e00**\n\n<details>\n<summary>\u4f7f\u7528 nb-cli \u5b89\u88c5</summary>\n\n\u5728 nonebot2 \u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u6253\u5f00\u547d\u4ee4\u884c, \u8f93\u5165\u4ee5\u4e0b\u6307\u4ee4\u5373\u53ef\u5b89\u88c5\n\n    nb plugin install nonebot-plugin-system-command\n\n</details>\n\n<details>\n<summary>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5</summary>\n\n\u5728 nonebot2 \u9879\u76ee\u7684\u63d2\u4ef6\u76ee\u5f55\u4e0b, \u6253\u5f00\u547d\u4ee4\u884c,\n\n**\u6839\u636e\u4f60\u4f7f\u7528\u7684\u5305\u7ba1\u7406\u5668, \u8f93\u5165\u76f8\u5e94\u7684\u5b89\u88c5\u547d\u4ee4**\n\n<details>\n<summary>pip</summary>\n\n    pip install nonebot-plugin-system-command\n\n</details>\n<details>\n<summary>pdm</summary>\n\n    pdm add nonebot-plugin-system-command\n\n</details>\n<details>\n<summary>poetry</summary>\n\n    poetry add nonebot-plugin-system-command\n\n</details>\n<details>\n<summary>conda</summary>\n\n    conda install nonebot-plugin-system-command\n\n</details>\n\n\u6253\u5f00 bot\u9879\u76ee\u4e0b\u7684 `pyproject.toml` \u6587\u4ef6,\n\n\u5728\u5176 `plugins` \u91cc\u52a0\u5165 `nonebot_plugin_system_command`\n\n    plugins = [\"nonebot_plugin_system_command\"]\n\n</details>\n</details>\n\n## \ud83c\udf89 \u4f7f\u7528\n\n- \u53ef\u5728 Bot\u9879\u76ee\u7684 `.env*` \u4e2d\u81ea\u5b9a\u4e49\u8c03\u7528\u547d\u4ee4\u884c\u7684\u6307\u4ee4,\n  \u9ed8\u8ba4\u503c\u4e3a `/sh` \u548c `/cmd`\n\n- \u5982\u679c `.env*` \u4e2d `COMMAND_START` \u53d8\u91cf\u503c\u4e3a `[\"/\"]`\n  \u90a3\u4e48\u6307\u4ee4\u5e94\u8be5\u4e3a `//sh` `//cmd`\n\n```env\nSYS_CMD_SH=\"/sh\"\nSYS_CMD_CMD=\"/cmd\"\n```\n\n### \u6307\u4ee4\u8868\n\n<table> \n  <tr align=\"center\">\n    <th> \u6307\u4ee4 </th>\n    <th> \u6743\u9650 </th>\n    <th> \u9700\u8981@ </th>\n    <th> \u8303\u56f4 </th>\n    <th> \u7279\u6027 </th>\n    <th> \u8bf4\u660e </th>\n  </tr>\n  <tr align=\"center\">\n    <td> /sh </td>\n    <td> \u4e3b\u4eba </td>\n    <td> \u5426 </td>\n    <td> \u79c1\u804a | \u7fa4\u804a </td>\n    <td> \u5f02\u6b65\u7ba1\u9053 </td>\n    <td> Windows\u73af\u5883\u65e0\u6cd5\u6b63\u5e38\u4f7f\u7528 </td>\n  </tr>\n  <tr align=\"center\">\n    <td> /cmd </td>\n    <td> \u4e3b\u4eba </td>\n    <td> \u5426 </td>\n    <td> \u79c1\u804a | \u7fa4\u804a </td>\n    <td> \u540c\u6b65\u7ba1\u9053 </td>\n    <td> \u901a\u7528 </td>\n  </tr>\n</table>\n\n### \u8bed\u6cd5\n\n\u547d\u4ee4\u884c\u8bed\u6cd5\u4e0eBot\u8fd0\u884c\u73af\u5883\u76f8\u5173, \u4e0e\u63d2\u4ef6\u6307\u4ee4\u65e0\u5173, `linux-shell` \u8fd0\u884c\u5373\u4f7f\u7528 `linux-shell` \u8bed\u6cd5, `cmd` \u8fd0\u884c\u5373\u4f7f\u7528 `cmd` \u8bed\u6cd5, `powershell` \u8fd0\u884c\u5373\u4f7f\u7528 `powershell` \u8bed\u6cd5\n\n### \u26a0\ufe0f ATTENTION!!\n\n\u81ea\u5b9a\u4e49\u6307\u4ee4\u524d\u8bf7\u4e09\u601d\u800c\u540e\u884c, \u786e\u4fdd\u672c\u63d2\u4ef6\u4e0d\u4f1a\u56e0\u4e3a\u54cd\u5e94\u4e86\u4e0d\u76f8\u5e72\u7684\u6d88\u606f, \u5bfc\u81f4\u8bbe\u5907\u906d\u53d7\u707e\u96be\u6027\u7684\u635f\u574f!\n\n### \u793a\u4f8b\n\n```\n/sh echo \"hello world\"\n```\n\n```\n/cmd echo \"hello world\"\n```\n\n## TODO\n\n- [x] \u4f7f\u7528\u5f02\u6b65\u7ba1\u9053\n- [ ] \u547d\u4ee4\u884c\u4ea4\u4e92\n\n## \u26a0\ufe0f ATTENTION!!!\n\nDon't drink and root!\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Call the system command in NoneBot2",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/tkgs0/nonebot-plugin-system-command",
        "Repository": "https://github.com/tkgs0/nonebot-plugin-system-command"
    },
    "split_keywords": [
        "nonebot",
        " nonebot2",
        " nonebot_plugin",
        " system",
        " shell",
        " cmd",
        " powershell"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6acd9f3ac1ecc4a9a70eef0b56b79a3e21101294b4f3b8bd3fcec5bb842c5856",
                "md5": "bd4d8bbcb43ea0ea606f7222cc9c75d7",
                "sha256": "5cf3655527b7631fb8d9de3e3ed66aca64928885a228b9a1c20a46245f21dca2"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_system_command-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bd4d8bbcb43ea0ea606f7222cc9c75d7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 5142,
            "upload_time": "2024-07-27T05:24:42",
            "upload_time_iso_8601": "2024-07-27T05:24:42.513810Z",
            "url": "https://files.pythonhosted.org/packages/6a/cd/9f3ac1ecc4a9a70eef0b56b79a3e21101294b4f3b8bd3fcec5bb842c5856/nonebot_plugin_system_command-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35848fe2d5577fbd4ba393a3d53d831ae5d6d86df86a921d5fc4bbe70c0a1767",
                "md5": "08287648307784b2a0045492dedf90da",
                "sha256": "9a63bb400781b2c2bf0de2624c4355762919126e18c37252da78a30f0e9d2b2b"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_system_command-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "08287648307784b2a0045492dedf90da",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 4323,
            "upload_time": "2024-07-27T05:24:43",
            "upload_time_iso_8601": "2024-07-27T05:24:43.990254Z",
            "url": "https://files.pythonhosted.org/packages/35/84/8fe2d5577fbd4ba393a3d53d831ae5d6d86df86a921d5fc4bbe70c0a1767/nonebot_plugin_system_command-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-27 05:24:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tkgs0",
    "github_project": "nonebot-plugin-system-command",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nonebot-plugin-system-command"
}
        
Elapsed time: 0.28885s