nonebot-plugin-op-finder


Namenonebot-plugin-op-finder JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryNonebot2 plugin. (only for kaheila adaptor)
upload_time2023-10-06 16:40:24
maintainer
docs_urlNone
author
requires_python>=3.8
licenseGPL-3.0-only
keywords nonebot2 kook kaiheila genshin impact
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<div align="center">

# nonebot-plugin-op-finder

_✨ Only for kaiheila adaptor ✨_

<a href="./LICENSE">
    <img src="https://img.shields.io/github/license/ninthseason/nonebot-plugin-op-finder.svg" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot-plugin-op-finder">
    <img src="https://img.shields.io/pypi/v/nonebot-plugin-op-finder.svg" alt="pypi">
</a>
<img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="python">

</div>

## 📖 介绍

显示服务器中当前正在玩原神的玩家,效果图见下文。

## 💿 安装

<details open>
<summary>使用 nb-cli 安装</summary>
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装

    nb plugin install nonebot-plugin-op-finder

</details>

<details>
<summary>使用包管理器安装</summary>
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令

<details>
<summary>pip</summary>

    pip install nonebot-plugin-op-finder
</details>
<details>
<summary>pdm</summary>

    pdm add nonebot-plugin-op-finder
</details>
<details>
<summary>poetry</summary>

    poetry add nonebot-plugin-op-finder
</details>
<details>
<summary>conda</summary>

    conda install nonebot-plugin-op-finder
</details>

打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入

    plugins = ["nonebot_plugin_op_finder"]

</details>

## ⚙️ 配置

kaiheila adaptor 相关配置请见[kaiheila adaptor 使用指南](https://github.com/Tian-que/nonebot-adapter-kaiheila/blob/master/MANUAL.md)

本插件需要在 nonebot2 项目的`.env`文件中添加下表中的配置

| 配置项 | 必填 | 默认值 | 说明 |
|:-----:|:----:|:----:|:----:|
| kook_auth_key | 是 | 无 | 自己账号的kook鉴权cookie |

因为目前KOOK v3 api中没有获得玩家在玩状态的接口,本插件通过v2 api获取玩家在玩状态。

由于v2 api不受官方支持,需要手动抓包获取一个账号的鉴权cookie,用以调用api。

1. 登录网页版KOOK,随便进入一个服务器,打开浏览器控制台
2. 控制台切换到Network(网络)选项卡
3. KOOK中随意点击一个用户的头像,打开资料面板
4. 此时Network选项卡中应会抓到若干请求,随意选择一个v2api的请求查看,如 `https://www.kookapp.cn/api/v2/users/<用户id>?guild_id=<服务器id>`
5. 查看请求的Headers选项卡中的Request Headers(请求头),找到Cookie键,形如
   
   ```
   Cookie: auth=<kook_auth_key>; PHPSESSID=<something>; _csrf_chuanyu=<something>
   ```

6. 其中<kook_auth_key>即为我们需要的配置项

> **此实在是不得已而为之的下策,若v3 api有获取在玩状态的方法,或更方便获取v2 api auth key的方法,敬请告知。**

## 🎉 使用
### 指令表
| 指令 | 权限 | 需要@ | 范围 | 说明 |
|:-----:|:----:|:----:|:----:|:----:|
| /查找原批 \|\| /原批 \|\| /op | 所有人 | 否 | 群聊 | 触发插件 |

> **指令命名纯属调侃,无恶意**

### 效果图
![](./rendering.png)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "nonebot-plugin-op-finder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "nonebot2,kook,kaiheila,Genshin Impact",
    "author": "",
    "author_email": "Kl1nge5 <ninthseason@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/37/bb/cce77ef4b18c8de4334c0d8efcec80b1ffbfed09fe99e8139658671138a7/nonebot-plugin-op-finder-1.0.0.tar.gz",
    "platform": null,
    "description": "\n<div align=\"center\">\n\n# nonebot-plugin-op-finder\n\n_\u2728 Only for kaiheila adaptor \u2728_\n\n<a href=\"./LICENSE\">\n    <img src=\"https://img.shields.io/github/license/ninthseason/nonebot-plugin-op-finder.svg\" alt=\"license\">\n</a>\n<a href=\"https://pypi.python.org/pypi/nonebot-plugin-op-finder\">\n    <img src=\"https://img.shields.io/pypi/v/nonebot-plugin-op-finder.svg\" alt=\"pypi\">\n</a>\n<img src=\"https://img.shields.io/badge/python-3.8+-blue.svg\" alt=\"python\">\n\n</div>\n\n## \ud83d\udcd6 \u4ecb\u7ecd\n\n\u663e\u793a\u670d\u52a1\u5668\u4e2d\u5f53\u524d\u6b63\u5728\u73a9\u539f\u795e\u7684\u73a9\u5bb6\uff0c\u6548\u679c\u56fe\u89c1\u4e0b\u6587\u3002\n\n## \ud83d\udcbf \u5b89\u88c5\n\n<details open>\n<summary>\u4f7f\u7528 nb-cli \u5b89\u88c5</summary>\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-op-finder\n\n</details>\n\n<details>\n<summary>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5</summary>\n\u5728 nonebot2 \u9879\u76ee\u7684\u63d2\u4ef6\u76ee\u5f55\u4e0b, \u6253\u5f00\u547d\u4ee4\u884c, \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-op-finder\n</details>\n<details>\n<summary>pdm</summary>\n\n    pdm add nonebot-plugin-op-finder\n</details>\n<details>\n<summary>poetry</summary>\n\n    poetry add nonebot-plugin-op-finder\n</details>\n<details>\n<summary>conda</summary>\n\n    conda install nonebot-plugin-op-finder\n</details>\n\n\u6253\u5f00 nonebot2 \u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u7684 `pyproject.toml` \u6587\u4ef6, \u5728 `[tool.nonebot]` \u90e8\u5206\u8ffd\u52a0\u5199\u5165\n\n    plugins = [\"nonebot_plugin_op_finder\"]\n\n</details>\n\n## \u2699\ufe0f \u914d\u7f6e\n\nkaiheila adaptor \u76f8\u5173\u914d\u7f6e\u8bf7\u89c1[kaiheila adaptor \u4f7f\u7528\u6307\u5357](https://github.com/Tian-que/nonebot-adapter-kaiheila/blob/master/MANUAL.md)\n\n\u672c\u63d2\u4ef6\u9700\u8981\u5728 nonebot2 \u9879\u76ee\u7684`.env`\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e0b\u8868\u4e2d\u7684\u914d\u7f6e\n\n| \u914d\u7f6e\u9879 | \u5fc5\u586b | \u9ed8\u8ba4\u503c | \u8bf4\u660e |\n|:-----:|:----:|:----:|:----:|\n| kook_auth_key | \u662f | \u65e0 | \u81ea\u5df1\u8d26\u53f7\u7684kook\u9274\u6743cookie |\n\n\u56e0\u4e3a\u76ee\u524dKOOK v3 api\u4e2d\u6ca1\u6709\u83b7\u5f97\u73a9\u5bb6\u5728\u73a9\u72b6\u6001\u7684\u63a5\u53e3\uff0c\u672c\u63d2\u4ef6\u901a\u8fc7v2 api\u83b7\u53d6\u73a9\u5bb6\u5728\u73a9\u72b6\u6001\u3002\n\n\u7531\u4e8ev2 api\u4e0d\u53d7\u5b98\u65b9\u652f\u6301\uff0c\u9700\u8981\u624b\u52a8\u6293\u5305\u83b7\u53d6\u4e00\u4e2a\u8d26\u53f7\u7684\u9274\u6743cookie\uff0c\u7528\u4ee5\u8c03\u7528api\u3002\n\n1. \u767b\u5f55\u7f51\u9875\u7248KOOK\uff0c\u968f\u4fbf\u8fdb\u5165\u4e00\u4e2a\u670d\u52a1\u5668\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\u63a7\u5236\u53f0\n2. \u63a7\u5236\u53f0\u5207\u6362\u5230Network(\u7f51\u7edc)\u9009\u9879\u5361\n3. KOOK\u4e2d\u968f\u610f\u70b9\u51fb\u4e00\u4e2a\u7528\u6237\u7684\u5934\u50cf\uff0c\u6253\u5f00\u8d44\u6599\u9762\u677f\n4. \u6b64\u65f6Network\u9009\u9879\u5361\u4e2d\u5e94\u4f1a\u6293\u5230\u82e5\u5e72\u8bf7\u6c42\uff0c\u968f\u610f\u9009\u62e9\u4e00\u4e2av2api\u7684\u8bf7\u6c42\u67e5\u770b\uff0c\u5982 `https://www.kookapp.cn/api/v2/users/<\u7528\u6237id>?guild_id=<\u670d\u52a1\u5668id>`\n5. \u67e5\u770b\u8bf7\u6c42\u7684Headers\u9009\u9879\u5361\u4e2d\u7684Request Headers(\u8bf7\u6c42\u5934)\uff0c\u627e\u5230Cookie\u952e\uff0c\u5f62\u5982\n   \n   ```\n   Cookie: auth=<kook_auth_key>; PHPSESSID=<something>; _csrf_chuanyu=<something>\n   ```\n\n6. \u5176\u4e2d<kook_auth_key>\u5373\u4e3a\u6211\u4eec\u9700\u8981\u7684\u914d\u7f6e\u9879\n\n> **\u6b64\u5b9e\u5728\u662f\u4e0d\u5f97\u5df2\u800c\u4e3a\u4e4b\u7684\u4e0b\u7b56\uff0c\u82e5v3 api\u6709\u83b7\u53d6\u5728\u73a9\u72b6\u6001\u7684\u65b9\u6cd5\uff0c\u6216\u66f4\u65b9\u4fbf\u83b7\u53d6v2 api auth key\u7684\u65b9\u6cd5\uff0c\u656c\u8bf7\u544a\u77e5\u3002**\n\n## \ud83c\udf89 \u4f7f\u7528\n### \u6307\u4ee4\u8868\n| \u6307\u4ee4 | \u6743\u9650 | \u9700\u8981@ | \u8303\u56f4 | \u8bf4\u660e |\n|:-----:|:----:|:----:|:----:|:----:|\n| /\u67e5\u627e\u539f\u6279 \\|\\| /\u539f\u6279 \\|\\| /op | \u6240\u6709\u4eba | \u5426 | \u7fa4\u804a | \u89e6\u53d1\u63d2\u4ef6 |\n\n> **\u6307\u4ee4\u547d\u540d\u7eaf\u5c5e\u8c03\u4f83\uff0c\u65e0\u6076\u610f**\n\n### \u6548\u679c\u56fe\n![](./rendering.png)\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "Nonebot2 plugin. (only for kaheila adaptor)",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "nonebot2",
        "kook",
        "kaiheila",
        "genshin impact"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63baca0e9b7d12647001a0d41bd88dae53a0fd95e1b06268134c8e7a8950d40f",
                "md5": "a521b58ae5c3035710a9ed96e2b1898e",
                "sha256": "a0a89615b0a4548d332e1ad9babb2c68ccc97b0e91f649b4c2024a92075eb55d"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_op_finder-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a521b58ae5c3035710a9ed96e2b1898e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 18462,
            "upload_time": "2023-10-06T16:40:22",
            "upload_time_iso_8601": "2023-10-06T16:40:22.375740Z",
            "url": "https://files.pythonhosted.org/packages/63/ba/ca0e9b7d12647001a0d41bd88dae53a0fd95e1b06268134c8e7a8950d40f/nonebot_plugin_op_finder-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "37bbcce77ef4b18c8de4334c0d8efcec80b1ffbfed09fe99e8139658671138a7",
                "md5": "739cf23ca1549b4d2445be4f700910f5",
                "sha256": "5e469f5cb48cb16e0912579b6bf3354964e08387bb68009f16f338bbf351d1bf"
            },
            "downloads": -1,
            "filename": "nonebot-plugin-op-finder-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "739cf23ca1549b4d2445be4f700910f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 124993,
            "upload_time": "2023-10-06T16:40:24",
            "upload_time_iso_8601": "2023-10-06T16:40:24.013176Z",
            "url": "https://files.pythonhosted.org/packages/37/bb/cce77ef4b18c8de4334c0d8efcec80b1ffbfed09fe99e8139658671138a7/nonebot-plugin-op-finder-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-06 16:40:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "nonebot-plugin-op-finder"
}
        
Elapsed time: 0.13794s