nonebot-plugin-status


Namenonebot-plugin-status JSON
Version 0.9.0 PyPI version JSON
download
home_pagehttps://github.com/nonebot/plugin-status
SummaryCheck your server status (CPU, Memory, Disk Usage) via nonebot
upload_time2024-09-03 09:21:00
maintainerNone
docs_urlNone
authoryanyongyu
requires_python<4.0,>=3.9
licenseMIT
keywords nonebot nonebot2 server status
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
 * @Author         : yanyongyu
 * @Date           : 2020-11-15 14:40:25
 * @LastEditors    : yanyongyu
 * @LastEditTime   : 2023-10-02 17:14:11
 * @Description    : None
 * @GitHub         : https://github.com/yanyongyu
-->

<!-- markdownlint-disable MD033 MD036 MD041 -->

<p align="center">
  <a href="https://nonebot.dev/"><img src="https://nonebot.dev/logo.png" width="200" height="200" alt="nonebot"></a>
</p>

<div align="center">

# nonebot-plugin-status

_✨ NoneBot 服务器状态(CPU, Memory, Disk Usage)查看插件 ✨_

</div>

<p align="center">
  <a href="https://raw.githubusercontent.com/cscs181/QQ-Github-Bot/master/LICENSE">
    <img src="https://img.shields.io/github/license/cscs181/QQ-Github-Bot.svg" alt="license">
  </a>
  <a href="https://pypi.python.org/pypi/nonebot-plugin-status">
    <img src="https://img.shields.io/pypi/v/nonebot-plugin-status.svg" alt="pypi">
  </a>
  <img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="python">
</p>

## 使用方式

通用:

- 发送 Command `状态` 或者 `status`

OneBot:

- 向机器人发送戳一戳表情
- 双击机器人头像戳一戳

## 配置项

> [!WARNING]
> GitHub 仓库中的文档为最新 DEV 版本,配置方式请参考 [PyPI](https://pypi.org/project/nonebot-plugin-status/) 上的文档。

配置方式:直接在 NoneBot 全局配置文件中添加以下配置项即可。

### server_status_enabled

- 类型:`bool`
- 默认值:`True`
- 说明:是否启用服务器状态查看功能

### server_status_truncate

- 类型:`bool`
- 默认值:`True`
- 说明:是否启用模板变量按需注入功能(节约时间)

### server_status_only_superusers

- 类型: `bool`
- 默认: `True`
- 说明: 是否仅允许超级用户使用

> 超级用户需在配置文件中如下配置:
>
> ```dotenv
> SUPERUSERS=["your qq id"]
> ```

### server_status_template

- 类型: `str`
- 默认: 请参考示例
- 说明:发送的消息模板,支持的方法、变量以及类型如下:
  - relative_time (`Callable[[datetime], timedelta]`): 获取相对时间
  - humanize_date (`Callable[[datetime], str]`): [人性化时间](https://python-humanize.readthedocs.io/en/latest/time/#humanize.time.naturaldate)
  - humanize_delta (`Callable[[timedelta], str]`): [人性化时间差](https://python-humanize.readthedocs.io/en/latest/time/#humanize.time.precisiondelta)
  - cpu_usage (`float`): CPU 使用率
  - per_cpu_usage (`List[float]`): 每个 CPU 核心的使用率
  - memory_usage (`svmem`): 内存使用情况,包含 total, available, percent, used, free(, active, inactive, buffers, cached, shared) 属性
  - swap_usage (`sswap`): 内存使用情况,包含 total, used, free, percent, sin, sout 属性
  - disk_usage (`Dict[str, psutil._common.sdiskusage]`): 磁盘使用率,包含 total, used, free, percent 属性
  - uptime (`datetime`): 服务器运行时间
  - runtime (`datetime`): NoneBot 运行时间
  - bot_connect_time (`Dict[str, datetime]`): 机器人连接时间

配置文件示例(默认模板)

```dotenv
SERVER_STATUS_TEMPLATE='
CPU: {{ "%02d" % cpu_usage }}%
Memory: {{ "%02d" % memory_usage.percent }}%
Runtime: {{ runtime | relative_time | humanize_delta }}
{% if swap_usage.total %}Swap: {{ "%02d" % swap_usage.percent }}%{% endif %}
Disk:
{% for name, usage in disk_usage.items() %}
  {{ name }}: {{ "%02d" % usage.percent }}%
{% endfor %}
'
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nonebot/plugin-status",
    "name": "nonebot-plugin-status",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "nonebot, nonebot2, server, status",
    "author": "yanyongyu",
    "author_email": "yyy@nonebot.dev",
    "download_url": "https://files.pythonhosted.org/packages/6f/d9/f28453bdcbfc8c95c92dc4e452c7fb53ddfcad6cbf69e2d4959c70bbb79b/nonebot_plugin_status-0.9.0.tar.gz",
    "platform": null,
    "description": "<!--\n * @Author         : yanyongyu\n * @Date           : 2020-11-15 14:40:25\n * @LastEditors    : yanyongyu\n * @LastEditTime   : 2023-10-02 17:14:11\n * @Description    : None\n * @GitHub         : https://github.com/yanyongyu\n-->\n\n<!-- markdownlint-disable MD033 MD036 MD041 -->\n\n<p align=\"center\">\n  <a href=\"https://nonebot.dev/\"><img src=\"https://nonebot.dev/logo.png\" width=\"200\" height=\"200\" alt=\"nonebot\"></a>\n</p>\n\n<div align=\"center\">\n\n# nonebot-plugin-status\n\n_\u2728 NoneBot \u670d\u52a1\u5668\u72b6\u6001\uff08CPU, Memory, Disk Usage\uff09\u67e5\u770b\u63d2\u4ef6 \u2728_\n\n</div>\n\n<p align=\"center\">\n  <a href=\"https://raw.githubusercontent.com/cscs181/QQ-Github-Bot/master/LICENSE\">\n    <img src=\"https://img.shields.io/github/license/cscs181/QQ-Github-Bot.svg\" alt=\"license\">\n  </a>\n  <a href=\"https://pypi.python.org/pypi/nonebot-plugin-status\">\n    <img src=\"https://img.shields.io/pypi/v/nonebot-plugin-status.svg\" alt=\"pypi\">\n  </a>\n  <img src=\"https://img.shields.io/badge/python-3.8+-blue.svg\" alt=\"python\">\n</p>\n\n## \u4f7f\u7528\u65b9\u5f0f\n\n\u901a\u7528:\n\n- \u53d1\u9001 Command `\u72b6\u6001` \u6216\u8005 `status`\n\nOneBot:\n\n- \u5411\u673a\u5668\u4eba\u53d1\u9001\u6233\u4e00\u6233\u8868\u60c5\n- \u53cc\u51fb\u673a\u5668\u4eba\u5934\u50cf\u6233\u4e00\u6233\n\n## \u914d\u7f6e\u9879\n\n> [!WARNING]\n> GitHub \u4ed3\u5e93\u4e2d\u7684\u6587\u6863\u4e3a\u6700\u65b0 DEV \u7248\u672c\uff0c\u914d\u7f6e\u65b9\u5f0f\u8bf7\u53c2\u8003 [PyPI](https://pypi.org/project/nonebot-plugin-status/) \u4e0a\u7684\u6587\u6863\u3002\n\n\u914d\u7f6e\u65b9\u5f0f\uff1a\u76f4\u63a5\u5728 NoneBot \u5168\u5c40\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\u9879\u5373\u53ef\u3002\n\n### server_status_enabled\n\n- \u7c7b\u578b\uff1a`bool`\n- \u9ed8\u8ba4\u503c\uff1a`True`\n- \u8bf4\u660e\uff1a\u662f\u5426\u542f\u7528\u670d\u52a1\u5668\u72b6\u6001\u67e5\u770b\u529f\u80fd\n\n### server_status_truncate\n\n- \u7c7b\u578b\uff1a`bool`\n- \u9ed8\u8ba4\u503c\uff1a`True`\n- \u8bf4\u660e\uff1a\u662f\u5426\u542f\u7528\u6a21\u677f\u53d8\u91cf\u6309\u9700\u6ce8\u5165\u529f\u80fd\uff08\u8282\u7ea6\u65f6\u95f4\uff09\n\n### server_status_only_superusers\n\n- \u7c7b\u578b: `bool`\n- \u9ed8\u8ba4: `True`\n- \u8bf4\u660e: \u662f\u5426\u4ec5\u5141\u8bb8\u8d85\u7ea7\u7528\u6237\u4f7f\u7528\n\n> \u8d85\u7ea7\u7528\u6237\u9700\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u5982\u4e0b\u914d\u7f6e:\n>\n> ```dotenv\n> SUPERUSERS=[\"your qq id\"]\n> ```\n\n### server_status_template\n\n- \u7c7b\u578b: `str`\n- \u9ed8\u8ba4: \u8bf7\u53c2\u8003\u793a\u4f8b\n- \u8bf4\u660e\uff1a\u53d1\u9001\u7684\u6d88\u606f\u6a21\u677f\uff0c\u652f\u6301\u7684\u65b9\u6cd5\u3001\u53d8\u91cf\u4ee5\u53ca\u7c7b\u578b\u5982\u4e0b\uff1a\n  - relative_time (`Callable[[datetime], timedelta]`): \u83b7\u53d6\u76f8\u5bf9\u65f6\u95f4\n  - humanize_date (`Callable[[datetime], str]`): [\u4eba\u6027\u5316\u65f6\u95f4](https://python-humanize.readthedocs.io/en/latest/time/#humanize.time.naturaldate)\n  - humanize_delta (`Callable[[timedelta], str]`): [\u4eba\u6027\u5316\u65f6\u95f4\u5dee](https://python-humanize.readthedocs.io/en/latest/time/#humanize.time.precisiondelta)\n  - cpu_usage (`float`): CPU \u4f7f\u7528\u7387\n  - per_cpu_usage (`List[float]`): \u6bcf\u4e2a CPU \u6838\u5fc3\u7684\u4f7f\u7528\u7387\n  - memory_usage (`svmem`): \u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff0c\u5305\u542b total, available, percent, used, free(, active, inactive, buffers, cached, shared) \u5c5e\u6027\n  - swap_usage (`sswap`): \u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff0c\u5305\u542b total, used, free, percent, sin, sout \u5c5e\u6027\n  - disk_usage (`Dict[str, psutil._common.sdiskusage]`): \u78c1\u76d8\u4f7f\u7528\u7387\uff0c\u5305\u542b total, used, free, percent \u5c5e\u6027\n  - uptime (`datetime`): \u670d\u52a1\u5668\u8fd0\u884c\u65f6\u95f4\n  - runtime (`datetime`): NoneBot \u8fd0\u884c\u65f6\u95f4\n  - bot_connect_time (`Dict[str, datetime]`): \u673a\u5668\u4eba\u8fde\u63a5\u65f6\u95f4\n\n\u914d\u7f6e\u6587\u4ef6\u793a\u4f8b\uff08\u9ed8\u8ba4\u6a21\u677f\uff09\n\n```dotenv\nSERVER_STATUS_TEMPLATE='\nCPU: {{ \"%02d\" % cpu_usage }}%\nMemory: {{ \"%02d\" % memory_usage.percent }}%\nRuntime: {{ runtime | relative_time | humanize_delta }}\n{% if swap_usage.total %}Swap: {{ \"%02d\" % swap_usage.percent }}%{% endif %}\nDisk:\n{% for name, usage in disk_usage.items() %}\n  {{ name }}: {{ \"%02d\" % usage.percent }}%\n{% endfor %}\n'\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Check your server status (CPU, Memory, Disk Usage) via nonebot",
    "version": "0.9.0",
    "project_urls": {
        "Documentation": "https://github.com/nonebot/plugin-status#readme",
        "Homepage": "https://github.com/nonebot/plugin-status",
        "Repository": "https://github.com/nonebot/plugin-status"
    },
    "split_keywords": [
        "nonebot",
        " nonebot2",
        " server",
        " status"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "807c484d1ec641eda18d8c5cc07a51c476061123a115ee37307614d40ee32ff8",
                "md5": "30be6a2a7a419138867f6c796cd82a90",
                "sha256": "7322cc8f360aedfcaffee565f5615f26f05c9314e71f6c503517ed3b7cec23b0"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_status-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "30be6a2a7a419138867f6c796cd82a90",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 9061,
            "upload_time": "2024-09-03T09:20:59",
            "upload_time_iso_8601": "2024-09-03T09:20:59.379554Z",
            "url": "https://files.pythonhosted.org/packages/80/7c/484d1ec641eda18d8c5cc07a51c476061123a115ee37307614d40ee32ff8/nonebot_plugin_status-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fd9f28453bdcbfc8c95c92dc4e452c7fb53ddfcad6cbf69e2d4959c70bbb79b",
                "md5": "cc3385fef3e1cab6bd3a3341736f0617",
                "sha256": "59dc4c709400409fcdefa5a1f3e2b3ace406509436055dfde39855e74f70a7e3"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_status-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cc3385fef3e1cab6bd3a3341736f0617",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 6988,
            "upload_time": "2024-09-03T09:21:00",
            "upload_time_iso_8601": "2024-09-03T09:21:00.625738Z",
            "url": "https://files.pythonhosted.org/packages/6f/d9/f28453bdcbfc8c95c92dc4e452c7fb53ddfcad6cbf69e2d4959c70bbb79b/nonebot_plugin_status-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-03 09:21:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nonebot",
    "github_project": "plugin-status",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nonebot-plugin-status"
}
        
Elapsed time: 1.70416s