Skip to main content

nonebot-plugin-morep-finder

✨ Extend from op finder ✨

license pypi python

📖 介绍

显示服务器中当前正在玩指定游戏的玩家,效果图见下文。

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-morep-finder
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-morep-finder
pdm
pdm add nonebot-plugin-morep-finder
poetry
poetry add nonebot-plugin-morep-finder
conda
conda install nonebot-plugin-morep-finder

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

plugins = ["nonebot_plugin_morep_finder"]

⚙️ 配置

kaiheila adaptor 相关配置请见kaiheila adaptor 使用指南

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

配置项 必填 默认值 说明
kook_auth_key 是 无 自己账号的kook鉴权cookie
morep_config 是 [] 插件配置(详见下文)
  1. kook_auth_key

    因为目前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的方法,敬请告知。

  2. morep_config

    一个元素为字典的列表,字典格式为:

    {
         "name": "对此类玩家的称呼",
         "color": "称呼颜色",
         "game": ["游戏名称1", "游戏名称2", ...],
         "command": ["触发指令1", "触发指令2", ...]
    }
    

    例如下面的字典:

    {
         "name": "塔批",
         "color": "warning",
         "game": ["逃离塔科夫", "逃离唐科夫", "进入孤儿院", "逃离提瓦特大陆"],
         "command": ["tkf", "tp", "寻找塔批"]
    }
    

    机器人在收到tkf | tp | 寻找塔批指令时,会列出服务器中所有在玩状态为"逃离塔科夫" | "逃离唐科夫" | "进入孤儿院" | "逃离提瓦特大陆"的玩家。

  3. color目前已知的可选值为primary, success, danger, warning, info, secondary, body, tips, pink, purple

一个morep_config示例:

morep_config = [{"name": "原批","color": "purple","game": ["原神"],"command": ["op", "寻找原批", "查找原批", "原批"]},{"name": "塔批","color": "warning","game": ["逃离塔科夫", "逃离唐科夫", "进入孤儿院", "逃离提瓦特大陆"],"command": ["tkf", "tp", "寻找塔批", "查找塔批", "塔批"]},{"name": "瓦批","color": "pink","game": ["瓦洛兰特", "无畏契约"],"command": ["wp", "瓦批", "瓦洛兰特", "无畏契约"]}, {"name": "穹批", "color": "purple", "game": ["崩坏:星穹铁道", "崩坏: 星穹铁道", "星穹铁道"], "command": ["qp", "穹批", "寻找穹批", "查找穹批"]}]

注意:为保证正常解析,请将morep_config保持在一行内,不要换行

🎉 使用

指令表

指令 权限 需要@ 范围 说明
在morep_config中指定 所有人 否 群聊 触发插件

效果图

Metadata

Release files for nonebot-plugin-morep-finder 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-morep-finder 1.0.0
File Size Uploaded Provenance Actions
nonebot-plugin-morep-finder-1.0.0.tar.gz 412.7 kB Without provenance Details for nonebot-plugin-morep-finder-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-morep-finder 1.0.0
File Interpreter ABI Platform Actions
nonebot_plugin_morep_finder-1.0.0-py3-none-any.whl Python 3 none any Details for nonebot_plugin_morep_finder-1.0.0-py3-none-any.whl

Total release size: 432.0 kB

Release files / nonebot-plugin-morep-finder-1.0.0.tar.gz

Download URL nonebot-plugin-morep-finder-1.0.0.tar.gz
Size 412.7 kB
Tags Source
SHA-256 checksum
How to use checksums
95c0f7fc983cbc4a80d4c787aa3875efdff9313489a506b0b79fe521b10a8108
BLAKE2b-256 checksum
How to use checksums
db2c59b39625bfe77832b0246a0e744c0a9f52cfec8e41da52bdc49e4c7892dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / nonebot_plugin_morep_finder-1.0.0-py3-none-any.whl

Download URL nonebot_plugin_morep_finder-1.0.0-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7052e3a43895f8b396a8a59bb9df90569acd9c859750d764f0a2114753595d25
BLAKE2b-256 checksum
How to use checksums
7f917a270b1f8cd29d38b36be68698d25ab3d1a8b39ae8e3f3a59bd6232eafdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Security for nonebot-plugin-morep-finder 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page