nonebot-plugin-trace-moe


Namenonebot-plugin-trace-moe JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/Ikaros-521/nonebot_plugin_trace_moe
Summary适用于nonebot2 v11的基于trace.moe的动画截图场景追溯插件
upload_time2022-12-11 12:00:43
maintainer
docs_urlNone
authorIkaros
requires_python>=3.8,<4.0
licenseMIT
keywords
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://github.com/A-kirami/nonebot-plugin-template/blob/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
  <br>
  <p><img src="https://github.com/A-kirami/nonebot-plugin-template/blob/resources/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText"></p>
</div>

<div align="center">

# nonebot_plugin_trace_moe
  
_✨ NoneBot 基于trace.moe的动画截图场景追溯插件 ✨_
  
<a href="https://github.com/Ikaros-521/nonebot_plugin_trace_moe/stargazers">
    <img alt="GitHub stars" src="https://img.shields.io/github/stars/Ikaros-521/nonebot_plugin_trace_moe?color=%09%2300BFFF&style=flat-square">
</a>
<a href="https://github.com/Ikaros-521/nonebot_plugin_trace_moe/issues">
    <img alt="GitHub issues" src="https://img.shields.io/github/issues/Ikaros-521/nonebot_plugin_trace_moe?color=Emerald%20green&style=flat-square">
</a>
<a href="https://github.com/Ikaros-521/nonebot_plugin_trace_moe/network">
    <img alt="GitHub forks" src="https://img.shields.io/github/forks/Ikaros-521/nonebot_plugin_trace_moe?color=%2300BFFF&style=flat-square">
</a>
<a href="./LICENSE">
    <img src="https://img.shields.io/github/license/Ikaros-521/nonebot_plugin_trace_moe.svg" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot_plugin_trace_moe">
    <img src="https://img.shields.io/pypi/v/nonebot_plugin_trace_moe.svg" alt="pypi">
</a>
<a href="https://www.python.org">
    <img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="python">
</a>

</div>

适用于nonebot2 v11的基于trace.moe的动画截图场景追溯插件  
调用的相关API源自:https://soruly.github.io/trace.moe-api/#/  

## 🔧 开发环境
Nonebot2:2.0.0b5  
python:3.8.13  
操作系统:Windows10(Linux兼容性问题不大)  
编辑器:pycharm  

## 💿 安装
环境依赖`aiohttp`库   

### 1. nb-cli安装(推荐)
在你bot工程的文件夹下,运行cmd(运行路径要对啊),执行nb命令安装插件,插件配置会自动添加至配置文件  
```
nb plugin install nonebot_plugin_trace_moe
```

### 2. 本地安装
先安装下 `aiohttp`  
```
pip install aiohttp
```
将项目clone到你的机器人插件下的对应插件目录内(一般为机器人文件夹下的`src/plugins`),然后把`nonebot_plugin_trace_moe`文件夹里的内容拷贝至上一级目录即可。  
clone命令参考(得先装`git`,懂的都懂):
```
git clone https://github.com/Ikaros-521/nonebot_plugin_trace_moe.git
``` 
也可以直接下载压缩包到插件目录解压,然后同样提取`nonebot_plugin_trace_moe`至上一级目录。  
目录结构: ```你的bot/src/plugins/nonebot_plugin_trace_moe/__init__.py```  


### 3. pip安装
```
pip install nonebot_plugin_trace_moe
```  
打开 nonebot2 项目的 ```bot.py``` 文件, 在其中写入  
```nonebot.load_plugin('nonebot_plugin_trace_moe')```  
当然,如果是默认nb-cli创建的nonebot2的话,在bot路径```pyproject.toml```的```[tool.nonebot]```的```plugins```中添加```nonebot_plugin_trace_moe```即可  
pyproject.toml配置例如:  
``` 
[tool.nonebot]
plugin_dirs = ["src/plugins"]
plugins = ["nonebot_plugin_trace_moe"]
``` 

### 更新版本
```
nb plugin update nonebot_plugin_trace_moe
```

## 🔧 配置  

### env配置
```
# nonebot_plugin_trace_moe
# 最大返回查询结果数
TRACE_MOE_MAX_RET=3
```
|       配置项        | 必填 | 默认值  |                      说明                      |
|:----------------:|:----:|:----:|:----------------------------:|
| `TRACE_MOE_MAX_RET` | 否 | `3` | 最大返回查询结果数 |


## 🎉 功能
调用trace.moe的API查询动画截图源自的作品名和时间段  

## 👉 命令

### 1、先发送命令,再发送图片(命令前缀请自行替换)
先发送`/图片来源`或`/trace`或`/图片定位`,等bot返回`请发送需要识别的图片喵~`后,发送需要识别的图片即可。  

### 2、命令+图片
编辑消息`/图片来源[待识别的图片]`或`/trace[待识别的图片]`或`/图片定位[待识别的图片]`发送即可。  

### 3、回复图片+命令
回复需要处理的图片,发送`/图片来源`或`/trace`或`/图片定位`即可。  

## ⚙ 拓展
修改`__init__.py`中的`catch_str = on_command("图片来源", aliases={"trace", "图片定位"})`来自定义命令触发关键词。  

## 📝 更新日志

<details>
<summary>展开/收起</summary>

### 0.0.1

- 插件初次发布

### 0.0.2

- 向上兼容rc2  

### 0.0.3

- 可以通过回复图片触发  

</details>

## 致谢

- [trace.moe](https://trace.moe) - API来源  

## 项目打包上传至pypi

官网:https://pypi.org,注册账号,在系统用户根目录下创建`.pypirc`,配置  
``` 
[distutils] 
index-servers=pypi 
 
[pypi] repository = https://upload.pypi.org/legacy/ 
username = 用户名 
password = 密码
```

### poetry

```
# 参考 https://www.freesion.com/article/58051228882/
# poetry config pypi-token.pypi

# 1、安装poetry
pip install poetry

# 2、初始化配置文件(根据提示填写)
poetry init

# 3、微调配置文件pyproject.toml

# 4、运行 poetry install, 可生成 “poetry.lock” 文件(可跳过)
poetry install

# 5、编译,生成dist
poetry build

# 6、发布(poetry config pypi-token.pypi 配置token)
poetry publish

```

### twine

```
# 参考 https://www.cnblogs.com/danhuai/p/14915042.html
#创建setup.py文件 填写相关信息

# 1、可以先升级打包工具
pip install --upgrade setuptools wheel twine

# 2、打包
python setup.py sdist bdist_wheel

# 3、可以先检查一下包
twine check dist/*

# 4、上传包到pypi(需输入用户名、密码)
twine upload dist/*
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Ikaros-521/nonebot_plugin_trace_moe",
    "name": "nonebot-plugin-trace-moe",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Ikaros",
    "author_email": "327209194@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/46/a9/9d4405c4eafb7f89f983d6bb403e16f5c4d457136bc2c81f70b291c3eea7/nonebot_plugin_trace_moe-0.0.3.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <a href=\"https://v2.nonebot.dev/store\"><img src=\"https://github.com/A-kirami/nonebot-plugin-template/blob/resources/nbp_logo.png\" width=\"180\" height=\"180\" alt=\"NoneBotPluginLogo\"></a>\n  <br>\n  <p><img src=\"https://github.com/A-kirami/nonebot-plugin-template/blob/resources/NoneBotPlugin.svg\" width=\"240\" alt=\"NoneBotPluginText\"></p>\n</div>\n\n<div align=\"center\">\n\n# nonebot_plugin_trace_moe\n  \n_\u2728 NoneBot \u57fa\u4e8etrace.moe\u7684\u52a8\u753b\u622a\u56fe\u573a\u666f\u8ffd\u6eaf\u63d2\u4ef6 \u2728_\n  \n<a href=\"https://github.com/Ikaros-521/nonebot_plugin_trace_moe/stargazers\">\n    <img alt=\"GitHub stars\" src=\"https://img.shields.io/github/stars/Ikaros-521/nonebot_plugin_trace_moe?color=%09%2300BFFF&style=flat-square\">\n</a>\n<a href=\"https://github.com/Ikaros-521/nonebot_plugin_trace_moe/issues\">\n    <img alt=\"GitHub issues\" src=\"https://img.shields.io/github/issues/Ikaros-521/nonebot_plugin_trace_moe?color=Emerald%20green&style=flat-square\">\n</a>\n<a href=\"https://github.com/Ikaros-521/nonebot_plugin_trace_moe/network\">\n    <img alt=\"GitHub forks\" src=\"https://img.shields.io/github/forks/Ikaros-521/nonebot_plugin_trace_moe?color=%2300BFFF&style=flat-square\">\n</a>\n<a href=\"./LICENSE\">\n    <img src=\"https://img.shields.io/github/license/Ikaros-521/nonebot_plugin_trace_moe.svg\" alt=\"license\">\n</a>\n<a href=\"https://pypi.python.org/pypi/nonebot_plugin_trace_moe\">\n    <img src=\"https://img.shields.io/pypi/v/nonebot_plugin_trace_moe.svg\" alt=\"pypi\">\n</a>\n<a href=\"https://www.python.org\">\n    <img src=\"https://img.shields.io/badge/python-3.8+-blue.svg\" alt=\"python\">\n</a>\n\n</div>\n\n\u9002\u7528\u4e8enonebot2 v11\u7684\u57fa\u4e8etrace.moe\u7684\u52a8\u753b\u622a\u56fe\u573a\u666f\u8ffd\u6eaf\u63d2\u4ef6  \n\u8c03\u7528\u7684\u76f8\u5173API\u6e90\u81ea:https://soruly.github.io/trace.moe-api/#/  \n\n## \ud83d\udd27 \u5f00\u53d1\u73af\u5883\nNonebot2\uff1a2.0.0b5  \npython\uff1a3.8.13  \n\u64cd\u4f5c\u7cfb\u7edf\uff1aWindows10\uff08Linux\u517c\u5bb9\u6027\u95ee\u9898\u4e0d\u5927\uff09  \n\u7f16\u8f91\u5668\uff1apycharm  \n\n## \ud83d\udcbf \u5b89\u88c5\n\u73af\u5883\u4f9d\u8d56`aiohttp`\u5e93   \n\n### 1. nb-cli\u5b89\u88c5\uff08\u63a8\u8350\uff09\n\u5728\u4f60bot\u5de5\u7a0b\u7684\u6587\u4ef6\u5939\u4e0b\uff0c\u8fd0\u884ccmd\uff08\u8fd0\u884c\u8def\u5f84\u8981\u5bf9\u554a\uff09\uff0c\u6267\u884cnb\u547d\u4ee4\u5b89\u88c5\u63d2\u4ef6\uff0c\u63d2\u4ef6\u914d\u7f6e\u4f1a\u81ea\u52a8\u6dfb\u52a0\u81f3\u914d\u7f6e\u6587\u4ef6  \n```\nnb plugin install nonebot_plugin_trace_moe\n```\n\n### 2. \u672c\u5730\u5b89\u88c5\n\u5148\u5b89\u88c5\u4e0b `aiohttp`  \n```\npip install aiohttp\n```\n\u5c06\u9879\u76eeclone\u5230\u4f60\u7684\u673a\u5668\u4eba\u63d2\u4ef6\u4e0b\u7684\u5bf9\u5e94\u63d2\u4ef6\u76ee\u5f55\u5185\uff08\u4e00\u822c\u4e3a\u673a\u5668\u4eba\u6587\u4ef6\u5939\u4e0b\u7684`src/plugins`\uff09\uff0c\u7136\u540e\u628a`nonebot_plugin_trace_moe`\u6587\u4ef6\u5939\u91cc\u7684\u5185\u5bb9\u62f7\u8d1d\u81f3\u4e0a\u4e00\u7ea7\u76ee\u5f55\u5373\u53ef\u3002  \nclone\u547d\u4ee4\u53c2\u8003\uff08\u5f97\u5148\u88c5`git`\uff0c\u61c2\u7684\u90fd\u61c2\uff09\uff1a\n```\ngit clone https://github.com/Ikaros-521/nonebot_plugin_trace_moe.git\n``` \n\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7d\u538b\u7f29\u5305\u5230\u63d2\u4ef6\u76ee\u5f55\u89e3\u538b\uff0c\u7136\u540e\u540c\u6837\u63d0\u53d6`nonebot_plugin_trace_moe`\u81f3\u4e0a\u4e00\u7ea7\u76ee\u5f55\u3002  \n\u76ee\u5f55\u7ed3\u6784\uff1a ```\u4f60\u7684bot/src/plugins/nonebot_plugin_trace_moe/__init__.py```  \n\n\n### 3. pip\u5b89\u88c5\n```\npip install nonebot_plugin_trace_moe\n```  \n\u6253\u5f00 nonebot2 \u9879\u76ee\u7684 ```bot.py``` \u6587\u4ef6, \u5728\u5176\u4e2d\u5199\u5165  \n```nonebot.load_plugin('nonebot_plugin_trace_moe')```  \n\u5f53\u7136\uff0c\u5982\u679c\u662f\u9ed8\u8ba4nb-cli\u521b\u5efa\u7684nonebot2\u7684\u8bdd\uff0c\u5728bot\u8def\u5f84```pyproject.toml```\u7684```[tool.nonebot]```\u7684```plugins```\u4e2d\u6dfb\u52a0```nonebot_plugin_trace_moe```\u5373\u53ef  \npyproject.toml\u914d\u7f6e\u4f8b\u5982\uff1a  \n``` \n[tool.nonebot]\nplugin_dirs = [\"src/plugins\"]\nplugins = [\"nonebot_plugin_trace_moe\"]\n``` \n\n### \u66f4\u65b0\u7248\u672c\n```\nnb plugin update nonebot_plugin_trace_moe\n```\n\n## \ud83d\udd27 \u914d\u7f6e  \n\n### env\u914d\u7f6e\n```\n# nonebot_plugin_trace_moe\n# \u6700\u5927\u8fd4\u56de\u67e5\u8be2\u7ed3\u679c\u6570\nTRACE_MOE_MAX_RET=3\n```\n|       \u914d\u7f6e\u9879        | \u5fc5\u586b | \u9ed8\u8ba4\u503c  |                      \u8bf4\u660e                      |\n|:----------------:|:----:|:----:|:----------------------------:|\n| `TRACE_MOE_MAX_RET` | \u5426 | `3` | \u6700\u5927\u8fd4\u56de\u67e5\u8be2\u7ed3\u679c\u6570 |\n\n\n## \ud83c\udf89 \u529f\u80fd\n\u8c03\u7528trace.moe\u7684API\u67e5\u8be2\u52a8\u753b\u622a\u56fe\u6e90\u81ea\u7684\u4f5c\u54c1\u540d\u548c\u65f6\u95f4\u6bb5  \n\n## \ud83d\udc49 \u547d\u4ee4\n\n### 1\u3001\u5148\u53d1\u9001\u547d\u4ee4\uff0c\u518d\u53d1\u9001\u56fe\u7247\uff08\u547d\u4ee4\u524d\u7f00\u8bf7\u81ea\u884c\u66ff\u6362\uff09\n\u5148\u53d1\u9001`/\u56fe\u7247\u6765\u6e90`\u6216`/trace`\u6216`/\u56fe\u7247\u5b9a\u4f4d`\uff0c\u7b49bot\u8fd4\u56de`\u8bf7\u53d1\u9001\u9700\u8981\u8bc6\u522b\u7684\u56fe\u7247\u55b5~`\u540e\uff0c\u53d1\u9001\u9700\u8981\u8bc6\u522b\u7684\u56fe\u7247\u5373\u53ef\u3002  \n\n### 2\u3001\u547d\u4ee4+\u56fe\u7247\n\u7f16\u8f91\u6d88\u606f`/\u56fe\u7247\u6765\u6e90[\u5f85\u8bc6\u522b\u7684\u56fe\u7247]`\u6216`/trace[\u5f85\u8bc6\u522b\u7684\u56fe\u7247]`\u6216`/\u56fe\u7247\u5b9a\u4f4d[\u5f85\u8bc6\u522b\u7684\u56fe\u7247]`\u53d1\u9001\u5373\u53ef\u3002  \n\n### 3\u3001\u56de\u590d\u56fe\u7247+\u547d\u4ee4\n\u56de\u590d\u9700\u8981\u5904\u7406\u7684\u56fe\u7247\uff0c\u53d1\u9001`/\u56fe\u7247\u6765\u6e90`\u6216`/trace`\u6216`/\u56fe\u7247\u5b9a\u4f4d`\u5373\u53ef\u3002  \n\n## \u2699 \u62d3\u5c55\n\u4fee\u6539`__init__.py`\u4e2d\u7684`catch_str = on_command(\"\u56fe\u7247\u6765\u6e90\", aliases={\"trace\", \"\u56fe\u7247\u5b9a\u4f4d\"})`\u6765\u81ea\u5b9a\u4e49\u547d\u4ee4\u89e6\u53d1\u5173\u952e\u8bcd\u3002  \n\n## \ud83d\udcdd \u66f4\u65b0\u65e5\u5fd7\n\n<details>\n<summary>\u5c55\u5f00/\u6536\u8d77</summary>\n\n### 0.0.1\n\n- \u63d2\u4ef6\u521d\u6b21\u53d1\u5e03\n\n### 0.0.2\n\n- \u5411\u4e0a\u517c\u5bb9rc2  \n\n### 0.0.3\n\n- \u53ef\u4ee5\u901a\u8fc7\u56de\u590d\u56fe\u7247\u89e6\u53d1  \n\n</details>\n\n## \u81f4\u8c22\n\n- [trace.moe](https://trace.moe) - API\u6765\u6e90  \n\n## \u9879\u76ee\u6253\u5305\u4e0a\u4f20\u81f3pypi\n\n\u5b98\u7f51\uff1ahttps://pypi.org\uff0c\u6ce8\u518c\u8d26\u53f7\uff0c\u5728\u7cfb\u7edf\u7528\u6237\u6839\u76ee\u5f55\u4e0b\u521b\u5efa`.pypirc`\uff0c\u914d\u7f6e  \n``` \n[distutils] \nindex-servers=pypi \n \n[pypi] repository = https://upload.pypi.org/legacy/ \nusername = \u7528\u6237\u540d \npassword = \u5bc6\u7801\n```\n\n### poetry\n\n```\n# \u53c2\u8003 https://www.freesion.com/article/58051228882/\n# poetry config pypi-token.pypi\n\n# 1\u3001\u5b89\u88c5poetry\npip install poetry\n\n# 2\u3001\u521d\u59cb\u5316\u914d\u7f6e\u6587\u4ef6\uff08\u6839\u636e\u63d0\u793a\u586b\u5199\uff09\npoetry init\n\n# 3\u3001\u5fae\u8c03\u914d\u7f6e\u6587\u4ef6pyproject.toml\n\n# 4\u3001\u8fd0\u884c poetry install, \u53ef\u751f\u6210 \u201cpoetry.lock\u201d \u6587\u4ef6\uff08\u53ef\u8df3\u8fc7\uff09\npoetry install\n\n# 5\u3001\u7f16\u8bd1\uff0c\u751f\u6210dist\npoetry build\n\n# 6\u3001\u53d1\u5e03(poetry config pypi-token.pypi \u914d\u7f6etoken)\npoetry publish\n\n```\n\n### twine\n\n```\n# \u53c2\u8003 https://www.cnblogs.com/danhuai/p/14915042.html\n#\u521b\u5efasetup.py\u6587\u4ef6 \u586b\u5199\u76f8\u5173\u4fe1\u606f\n\n# 1\u3001\u53ef\u4ee5\u5148\u5347\u7ea7\u6253\u5305\u5de5\u5177\npip install --upgrade setuptools wheel twine\n\n# 2\u3001\u6253\u5305\npython setup.py sdist bdist_wheel\n\n# 3\u3001\u53ef\u4ee5\u5148\u68c0\u67e5\u4e00\u4e0b\u5305\ntwine check dist/*\n\n# 4\u3001\u4e0a\u4f20\u5305\u5230pypi\uff08\u9700\u8f93\u5165\u7528\u6237\u540d\u3001\u5bc6\u7801\uff09\ntwine upload dist/*\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\u9002\u7528\u4e8enonebot2 v11\u7684\u57fa\u4e8etrace.moe\u7684\u52a8\u753b\u622a\u56fe\u573a\u666f\u8ffd\u6eaf\u63d2\u4ef6",
    "version": "0.0.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "5b5a026274735996a37d87190ca02f31",
                "sha256": "1f4ebf035a6a4c289d6c55ec7ec400866e366e683fe779a8f14c2d53fe0b1cef"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_trace_moe-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b5a026274735996a37d87190ca02f31",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 6820,
            "upload_time": "2022-12-11T12:00:41",
            "upload_time_iso_8601": "2022-12-11T12:00:41.738573Z",
            "url": "https://files.pythonhosted.org/packages/56/dd/0a2cdd49d13e151f927eca5b688cf302d819b3393c3976ddcbd391107027/nonebot_plugin_trace_moe-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "bff80134b1aec60e5030ea992a267a87",
                "sha256": "eeb74888429e3be7d6051f03b3a49410a2c06c889d473f5afeb21aab9aa5faee"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_trace_moe-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "bff80134b1aec60e5030ea992a267a87",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 7599,
            "upload_time": "2022-12-11T12:00:43",
            "upload_time_iso_8601": "2022-12-11T12:00:43.551766Z",
            "url": "https://files.pythonhosted.org/packages/46/a9/9d4405c4eafb7f89f983d6bb403e16f5c4d457136bc2c81f70b291c3eea7/nonebot_plugin_trace_moe-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-11 12:00:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Ikaros-521",
    "github_project": "nonebot_plugin_trace_moe",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nonebot-plugin-trace-moe"
}
        
Elapsed time: 0.02741s